jQWidgets Forums

jQuery UI Widgets Forums Grid Adding new row to jqxgrid

This topic contains 0 replies, has 1 voice, and was last updated by  mail2harisha 13 years ago.

Viewing 1 post (of 1 total)
  • Author
  • Adding new row to jqxgrid #4067

    mail2harisha
    Member

    Hi All,

    I want to add a new row to my jqxgrid.

    I have gone through this articles.
    http://www.jqwidgets.com/jquery-widgets-demo/#demos/jqxgrid/createremoveupdatedata.htm

    But I have a different scenario in which on click of Add button, I will call an ajax call to server and insert the data in table then return the newly inserted record (with some other data like unique server side id) in json object format.

    The return value is displaying properly but i am not able to add this json object to jqxgrid:

    This is the code.Kindly help:

    $.post(url, function(newBlotter) {
    alert("reply from server "+newBlotter);
    Displays: reply from server [{"id":"1","eblotter_ref":"20120510/113","buy":"Pay","nominal":"Actual","instrument":"10","rate":"10","start_date":"5/10/2012","end_date":"8/5/2012","counterparty":"ABSA","broker":"test","book":"test","marketwireref":"123","instructions":"test","status":"To be captured","source_reference":"","trade_event_type":"INSERT","source_system":"Murex"}]
    var rowdata = $.makeArray(newBlotter);
    alert(rowdata);
    Displays: [{"id":"1","eblotter_ref":"20120510/113","buy":"Pay","nominal":"Actual","instrument":"10","rate":"10","start_date":"5/10/2012","end_date":"8/5/2012","counterparty":"ABSA","broker":"test","book":"test","marketwireref":"123","instructions":"test","status":"To be captured","source_reference":"","trade_event_type":"INSERT","source_system":"Murex"}]
    alert("ref:"+rowdata[0].eblotter_ref);
    Displays:
    ref: undefined
    alert(rowdata[0]);
    Displays:
    [{"id":"1","eblotter_ref":"20120510/113","buy":"Pay","nominal":"Actual","instrument":"10","rate":"10","start_date":"5/10/2012","end_date":"8/5/2012","counterparty":"ABSA","broker":"test","book":"test","marketwireref":"123","instructions":"test","status":"To be captured","source_reference":"","trade_event_type":"INSERT","source_system":"Murex"}]
    var value = $("#jqxgrid").jqxGrid('addrow', null, rowdata[0]);
    alert("added ["+value+"]");
    Displays:
    added [false]
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.