Skip to Content
0
Former Member
May 09, 2018 at 01:42 PM

SAPUI5 data binding with factory function

582 Views

Dear Community,

I'm binding table items using factory function and using sap.m.DateTimePicker control in the table row template definition to select a date and time.


After date and time selected I click "OK" on the popup, it triggers the "change" function of the DateTimePicker.


I update the model of the table in the "change" function that will trigger the factory function of the table again. This will generate a different row template that does not contain the DateTimePicker anymore but shows the selected date and time.

While doing so I receive and error for the DateTimePicker popup close()

Uncaught TypeError: Cannot read property 'close' of undefined at f._selectDate (DatePicker-dbg.js:1103) at f._ (DateTimePicker-dbg.js:622) at f.p (jquery-dbg.js:497)

I've checked the DatePicker and it seems it tries to close the popup only after DateTimePicker change function executed.

...
this._oPopup.close();
(without any condition check)


If I click "Cancel" instead of "OK" even if I change the table model it does not cause an issue because in that case the popup close is handled properly:

if (this._oPopup && this._oPopup.isOpen()) {
this._oPopup.close();
...


Do you think it is a SAPUI5 issue or I 'm doing something wrong?

Thanks and best regards,
Sandor