jqGrid refresh the table and open previous getGridParam

201 views Asked by At

I have a button. this button opens new window where I can change status, watch changes, add comment. But first I want to resfresh my table and get the latest data from the server. how can i do this? I lose my getGridParam after updating table.

$("#btn").click(function(){   
$('#com').val("");
var form=page.table.jqGrid('getGridParam','selrow');if(!form) return;
/*alert(form);*/
/*$('#table').trigger('reloadGrid');*/
var status=page.table.getRowData(form).status;
/*alert(status);*/
tableUpdate(form);

});

1

There are 1 answers

0
Chandan On

Hello Gtufc92 Gtufc92,

It would be good if you have provided some fiddle or code snap here, so that can help others to understand about your question. Since I was having similar kind of requirement what needs reloading of grid after an inline edit. so, I mostly do use of below line of code:

$('#grid').jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid');

Alternatively, if you can use afterSubmitCell where you can trigger reload grid data, as shown here:

afterSubmitCell: function (serverresponse, rowid, cellname, value, iRow, iCol) {
            if (serverresponse.responseJSON.successFlag == 1) {

                    $.notify({ message: serverresponse.responseJSON.message }, {
                        type: "success", delay: 3000, placement: {
                            from: "top",
                            align: "center",

                        },
                    })                    
                var $self = $(this), p = $self.jqGrid("getGridParam");
                p.datatype = "json";
                $self.trigger("reloadGrid", { page: p.page, current: true });
                return [true]; // no error
            }
            else {
                return false;
            }

        },