Skip to Content
author's profile photo Former Member
Former Member

Adding rows in table using json model dynamically

how to create table with dynamic rows ?actally i have form and want to show form value in table whenever i am click save button in form?i am using json model so that it is taking newest values in all rows?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 01:12 PM

    For JSON models it's quite straightfoward.

    // Get json array from model
    var aData = oModel.getData();
    
    // Push additional row
    aData.push({{ "EmpId: "sfsdf", "EmpName" : "243", "EmpPos" : "Developer", "EmpDOJ" : "", "Skilss" : "abc.ewr" }); 
    
    // Refresh the model
    oModel.setData({aData});
    
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 01:02 PM

    Hello Ripu,

    Basically you should be able to achieve what you want by calling the function createEntry() on the model in the onclick Event of your Button and pass it your new Entry for the Model. I´m not sure about the behaviour for local Json Models but after the creation normally you have to call submitChanges() on the model to save your changes to the backend system.

    Regards

    Florian

    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.