Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This post solved my problem: </p> <p><a href="https://stackoverflow.com/questions/2826478/jqgrid-not-updating-data-on-reload">jqgrid not updating data on reload</a></p> <p>I had to move the code for reading the checkboxes values into a separate function and accessed that function inside the PostData and it worked like a charm. Without this it was sending the same data everytime.</p> <p>Updated code is below:</p> <pre><code>function BindGrid() { var jqDataUrl = null; jqDataUrl = "Alarm/LoadjqData" //+ x; $("#jqTable").jqGrid({ url: jqDataUrl, cache: false, datatype: "json", mtype: "POST", postData: { sp: function () { return getPriority(); } }, // Specify the column names colNames: ["Id", "PointRef", "Value", "AlarmStateName", "AckStateName", "Priority", "AlarmDate"], // Configure the columns colModel: [ { name: "AlarmId", index: "AlarmId", width: 70, align: "left" }, { name: "PointRef", index: "PointRef", width: 200, align: "left" }, { name: "Value", index: "Value", width: 200, align: "left" }, { name: "AlarmStateName", index: "AlarmStateName", width: 150, align: "left" }, { name: "AcknowledgementStateName", index: "AcknowledgementStateName", width: 170, align: "left" }, { name: "Priority", index: "Priority", width: 100, align: "left" }, { name: "AlarmDate", index: "AlarmDate", width: 250, align: "left" } ], // Grid total width and height width: 700, height: 250, // Paging toppager: true, pager: $("#jqTablePager"), rowNum: 10, rowList: [5, 10, 20], viewrecords: true, // Specify if "total number of records" is displayed // Default sorting sortname: "AlarmId", sortorder: "desc", // Grid caption caption: "Telemetry Alarms" }).navGrid("#jqTablePager", { refresh: true, add: false, edit: false, del: false }, {}, // settings for edit {}, // settings for add {}, // settings for delete {sopt: ["cn"]} // Search options. Some options can be set on column level ) .trigger('reloadGrid'); } function convertIntArrayToString(data) { var x = ''; //alert(data.length); for (var i = 0; i &lt; data.length; i++) { x = x + data[i] + ","; } if (x != '') { x = x.substr(0, x.length - 1); //alert(x); } return x.toString(); } function getPriority() { var selectedPriority = []; $('#priority input:checked').each(function () { selectedPriority.push($(this).val()); }); return convertIntArrayToString(selectedPriority); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload