Search code examples
javascriptjquerysapui5treetable

SAPUI5 Table getting recreated on event


I have a sapui5 treetable getting updated one buttion click event. On button click i am getting data using ajax and want repopulate the existing tree table rendered on first call. I have simulated the issue in below bin. How to avoid recreating the table on button click?

I tried to check the otable was null before recreating the object but it did not help. Please advise.

http://jsbin.com/openui5-table-json/889/edit


Solution

  • Because, you're recreating the table each time the press event occurs. As an alternate solution of yours, you can add a bit of logic to check if the table is already created.

    if(sap.ui.getCore().byId('idTable')===undefined){
         //code to create table
    }
    

    http://jsbin.com/openui5-table-json/897/edit