Sometimes jqgrid getChangedCell not return checkbox changed

95 views Asked by At



when I insert/update table data.
i use getChangedCell function for making input data before call API. like this.

 let inputData = _$myTable.getChangedCells('all');

 $.ajax({
            type: "POST",
            url: "/api/services/InsertData",
            dataType: "json",
            data: inputData
       })

Please check sample image.

First I check checkbox. after then click save button.
At this moment, generally _$myTable.getChangedCells('all') return the correct value.

But, sometimes _$myTable.getChangedCells('all') return []

Table options are :

 _$myTable.jqGrid({
                    mtype: "GET",
                    datatype: "local",
                    autowidth: true,
                    shrinkToFit: false,
                    cellEdit: true,
                    colModel: [
                        {
                            name: "id",
                            key: true,
                            hidden: true
                        },
                       ...
                    ],
                    onSelectRow: function (id) {
                        if (id && id !== optionlastsel) {
                            _$myTable.jqGrid('restoreRow', optionlastsel);
                            _$myTable.jqGrid('editRow', id, true);
                            optionlastsel = id;
                        }
                    },
                    afterEditCell: function (rowid, cellname, value, iRow, iCol) {
                        var checkboxNameSet = _.pluck(_.where(_$myTable.jqGrid("getGridParam").colModel, { edittype: 'checkbox' }), 'name');

                        if (checkboxNameSet.includes(cellname)) {
                            $('#' + rowid + '').addClass("edited");
                        }
                    }
                })

Checkbox options are:

{
  label: 'IsActive',
  name: "isActive",
  editable: true,
  edittype: 'checkbox',
  editoptions: { value: "true:false" },
  editrules: { required: true },
  formatter: "checkbox",
  formatoptions: { disabled: false },
  align: "center" 
}

In addition, all the time, the network was fine.

Are there any options I missed or mistake?

Thank you for reading.

0

There are 0 answers