jQWidgets Forums

jQuery UI Widgets Forums Grid addrow function problem

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • addrow function problem #69582

    web_hawk_ali
    Participant

    Hello,

    When I call addrow function inside loop it enters last iteration data in all rows of grid. I even debug the addrow function where before calling commit(true) my data is printed ok, but when commit(true) called data is not added properly. I am calling addrow function as follows:

    $.each(data, function(i, item) {
    datarow[‘objectiveName’] = data[i].objectiveName;
    datarow[‘objectiveTermName’] = data[i].objectiveTermName;
    datarow[‘objectiveTermWeight’] = data[i].objectiveTermWeight;
    var commit = $(“#objTermsGrid”).jqxGrid(‘addrow’, null, datarow);
    }

    and addrow function declaration is as follow:

    addrow: function (rowid, rowdataToBeAdded, position, commit) {
    console.log(commit);
    }

    Please look into this and let me know the solution.

    Thanks.

    addrow function problem #69583

    Peter Stoev
    Keymaster

    Hi web_hawk_ali,

    “commit” should and can be called only within the addrow callback function declared in the Grid’s source object. You can’t call it and should not try to call it outside that function. var commit = “….” is invalid syntax, too. I would suggest you to look at the jqxGrid’s examples and API Documentation about “addrow” method where it is explained and demonstrated how to use this correctly.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.