How to load the jqGrid again with some other data?

19 Views Asked by At

I have a webform with two different grid. One grid reload itself(correctly) when the form reload. # In the jqGrid action column, i want that when i click on the edit button the data of the particular customer should display in the textboxes and in the second jqGrid but the data correctly displays in the textboxes but not in the grid. I am using a generic handler to get data from the server.

Second Grid code in which i am recieving error although if i directly insert something it works  but with the edit button it doesnot display data
$('#tblProductGridID').jqGrid({
    mtype: 'GET',
    url: 'JHandler/Dashboard.ashx?GetProductGrid=1',
    datatype: 'json',
    colNames: ['ID', 'Product Name', 'Price', 'Quantity', 'Total Amount', 'Action'],
    colModel: [
        { name: 'intProductID', width: 10, hidden: true },
        { name: 'varName', width: 50, sortable: true },
        { name: 'flPrice', width: 50, sortable: true },
        { name: 'intQTY', width: 50, sortable: true },
        { name: 'flAmount', width: 50, sortable: true },
        { name: 'Action', width: 50, sortable: true }
    ],
});
//ajax call of edit button
function editCustomerRecord(id) {
    event.preventDefault();
    customerID = id;
    $.ajax({
        type: 'GET',
        url: 'JHandler/Dashboard.ashx?EditCustomer=1' + '&customerID=' + customerID,
        success: function (data) {
            debugger;
            var allData = data;
            addNewRecord();
            document.getElementById('btnSave').value = "Update";
            customerID = allData[0];
            document.getElementById('cName').value = allData[1];
            document.getElementById('cAddress').value = allData[2];
            document.getElementById('cContact').value = allData[3];
            $('#tblProductGridID').jqGrid('setGridParam', {
                url: 'JHandler/Dashboard.ashx'
            });
            $('#tblProductGridID').trigger("reloadGrid", [{ page: null, current: true }]);
        },
        error: function () {
            toastr.error("Error occured", "Edit Error", { timeout: 3000 });
        }
    });
}
0

There are 0 best solutions below