Skip to Content
avatar image
Former Member

SAPUI5 data binding with factory function

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

Add comment
10|10000 characters needed characters exceeded

  • Just a side note: it seems to me that what you are trying to accomplish is already pre-built on the Smart Table control. Have you checked that yet?

  • Former Member

    Thanks for the Note! I'm sure there are plenty of solutions available for the same problem. I managed to resolve it the way I described it in the Answer section.

    Best regards,
    Sandor

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 15 at 11:58 AM

    Finally I managed to resolve it with subscribing for the DateTimePicker popup afterClose event.

    dtp._oPopup.attachAfterClose(function() {...}

    Best regards,
    Sandor

    Add comment
    10|10000 characters needed characters exceeded