jQWidgets Forums

jQuery UI Widgets Forums Angular How to sync Database record to row after Add

This topic contains 2 replies, has 2 voices, and was last updated by  Ivo Zhulev 7 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • svedavya
    Participant

    Hello Team,

    Thank you for all the support and quick responses to queries, Could you please guide me on how to sync database record id to row after add in angular 2 or 4,

    addRow: (rowID, rowData, position, parentID, commit) => {
    this.newRowID = rowID;
    commit(true);
    }
    https://www.jqwidgets.com/angular/angular-treegrid/angular-treegrid-inlinerow.htm
    // synchronize with the server – send insert command
    // call commit with parameter true if the synchronization with the server is successful
    // and with parameter false if the synchronization failed.
    // you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB.

    this comment says we can send an additional parameter Can you please share a sample code or example.

    Thanks & Regards
    Sandeep vedavyas


    svedavya
    Participant

    Hi Team,

    Any suggestions on sync full object data/DB row id to row after add ?

    Kindly help.

    Thanks
    Sandeep


    Ivo Zhulev
    Participant

    Hi Sandeep,

    You must first sync with the server. If you generate the ID there(on the server) you can call the commit with a second argument representing that ID, giving the row created in the treeGrid this ID.

    
    addRow: (rowID, rowData, position, parentID, commit) => {
       // At this point, the ID is generated from the treeGrid(rowID)
    
       // Here you make the sync with the server and the server returns the ID created by it
    
       // You call commit with a second argument the ID received from the server. 
       // And the row in the treeGrid is created with the ID from the server, not rowID(which is by default)
    
       commit(true, IDReceivedFromTheServer);
    }
    

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.