<table id="UsersGrid"></table>
<script type="text/javascript">
$(document).ready(function () {
$('#UsersGrid').jqGrid({
colNames: ['Online', 'Computer', 'IP', 'User'],
colModel: [
{ name: 'IsOnline', width: 100, index: 'IsOnline', searchoptions: { sopt: ['eq', 'ne']} },
{ name: 'Name', index: 'Name', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'IP', index: 'IP', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'User', index: 'User', searchoptions: { sopt: ['eq', 'ne', 'cn']} }
],
height: 250,
datatype: getDataType
});
});
function getDataType() {
var grid = $("#UsersGrid");
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/GridTest/GridTestService.asmx/GetData",
data: jqGridSettings(grid),
dataType: "json",
success: function (response) {
jqGridDataReceived(response.d, grid);
}
});
}
function jqGridSettings(grid) {
return "{}";
var settings = {
};
return JSON.stringify(settings);
}
function jqGridDataReceived(json, grid) {
var rows = JSON.parse(json).rows;
grid.clearGridData();
for (var i = 0; i < rows.length; i++) {
grid.addRowData(i + 1, rows[i]);
}
}
</script>
I want to pass the original search parameters to the server-side, how can I retrieve them with javascript?
Namely, where can I get the grid's postData
?