h1

jqGrid Functions

October 3, 2014

Set Sorting :

$(“#tblJqGrid”).jqGrid(‘setGridParam’, {sortname:’columnname’, sortorder: ‘sordorder’ });
$(‘#tblJqGrid’).trigger(“reloadGrid”, [{ page: 1 }]);

Another Option :
$(“#tblJqGrid”).sortGrid(‘columnname’, reload);
reload is boolean(true/false) param.

Get current sorted column & order :

$(“#tblJqGrid”).jqGrid(‘getGridParam’, ‘sortname’);
$(“#tblJqGrid”).jqGrid(‘getGridParam’, ‘sortorder’);

Set jqGrid Data :

$(“#tblJqGrid”).jqGrid(‘setGridParam’, { data: jsonObjGridData });

Clear jqGrid Data :

$(“#tblJqGrid”).jqGrid(‘clearGridData’);

Show/Hide Columns :

$(“#tblJqGrid”).jqGrid(‘showCol’, [‘Column1’, ‘Column2’];
$(“#tblJqGrid”).jqGrid(‘hideCol’, [‘Column1’, ‘Column2’];

Resize jqGrid :

$(“#tblJqGrid”).jqGrid(‘setGridWidth’, , true).trigger(‘resize’);
$(“#tblJqGrid”).jqGrid(‘setGridHeight’, , true).trigger(‘resize’);

Reload jqGrid :

$(‘#tblJqGrid’).trigger(“reloadGrid”, [{ page: 1 }]);

Clear all values in search Toolbar :

$(“#JqGridId”)[0].clearToolbar();

Get value from cell :

var value = $(“#tblJqGrid”).jqGrid(‘getCell’, rowId, ‘ColumnName’ );

Set value to cell :

$(“#tblJqGrid”).jqGrid(‘setRowData’, rowId, { ColumnName: data });

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: