Skip to Content

add new row in the smart table

hello experts

in my project i need to add new rows in a smart table with editable data from json model , and then save data .

i used the binding context and CreateEntry but the smart table only shows data alredy existing in the backend .

when i debug i find the new data in the obindingContext but nothing is shown in the smart table .

this is my controller

var j = this.getView().getModel("oModeljson").getData();	
var tab = that.byId("smartTab");	
var oContext = new sap.ui.model.Context(that.oModel, "/entitySet");
 oContext =  that.oModel.createEntry("/entitySet", {
	properties: j[0]
		});
tab.setBindingContext(oContext);


also i am getting data in the getPendingChanges method.

my problem is how and add new row in a smart table ?

i dont now if i need to put my data in a metadata ?

actually i need to show only the new rows and not the existing data in the backend .

thank youu

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 20 at 07:19 AM

    Very unfortunately it doesn't work. The only way for the smart table to fetch the latest added records is if the records are saved to the backend system. The ones that you create using the createEntry will not be shown, especially for the smart table.

    createEntry will add data to normal m.table but only if you use the latest v4 odata model, which is not your case.

    You might wonder how it works for the list report object page applciation?, it also works only for the draft scneario, where the data is still saved but to the draft table.

    So you might have to rethink the design of your application in this case.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.