Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

refresh sap.ui table

Hi Experts ,

    

      I pulled data from a north wind service and displayed data in table .

there is a Create Product button above the table on click of it a pop to create a new product will appear and we can

enter the data and click on submit button , Then a new product is created .But this new product is not visible in the table automatically.

But if i refresh the browser i am able to see the new row (new product) .

Can any body guide me how can I resolve this sothat without refreshing the browser itself the new product should visible in the table automatically .

Please suggest.

I already tried sap.ui.getCore().getModel("Modelname ").refresh(). but no luck .

Thanks

Rizwan

replied

Hi All ,

         

Thanks for all your replies .Any how I got the solution for this as well as the reason why it is not updating in the table also .

I changed the init method and table xml code as below

init:

        var oDataModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V2/(S(u0fm33whthkboho0u01zhgyh))/OData/OData.svc", true);

          

  

        sap.ui.getCore().setModel(oDataModel,"productsModel");

I did not use the READmethod of ODATA .

View Code :

<t:Table id="productsTabId" rows="{productsModel>/Products}"> Here I changed the binding from results to Products

Now in create function the line of code

sap.ui.getCore().getModel("productsModel").refresh(true); is updating the model and i am able to see the new product in table .as my table is directly binded to that odata model as shown above ..

Thanks for all your replies which guided me to find the solution .

Thanks

Rizwan

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question