How to update value of data in jqgrid

前端 未结 3 1859
清歌不尽
清歌不尽 2020-11-28 12:37

I\'m trying to update a cell in jqgrid permanently upon loading. I know I can use setCell but that only updates the value for that page. If I come back to the

3条回答
  •  抹茶落季
    2020-11-28 13:33

    I had a similar issue:
    I needed to update a row upon a certain user-action (irrelevant).
    For that, I needed to know the exact row from the 'data' object, even after some filtering of the table.
    So I found a way to identify which row was changed - I added a RowID property for each item of the 'data' object, at the 'loadComplete' event:

    loadComplete: function () {
                if (firstRun) {
                    firstRun = false;
                    var dataArray = $('#jqGrid').jqGrid('getGridParam', 'data');
                    $(dataArray).each(function (index) {
                        dataArray[index].RowID = index + 1;
                    });
                }
            }
    

    And now, at the formatter code, I was able to access rData.RowID to identify the exact row on which the action was taken, and to get/set its 'data' representation

提交回复
热议问题