Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of Index attribute in jqgrid colModel?

I'm newbie to jqGrid, Can anybody explain what is the use of Index attribute in jqgrid colModel

like image 258
Den Avatar asked Oct 14 '25 03:10

Den


1 Answers

If you use datatype: "json" or datatype: "xml" without additional usage of loadonce: true parameters then the sorting and filtering of data have to be implemented on the server side. For example if you have the column defined as

{ name: "colName1", index: "colIndex1", ...}

then if the user clicks on the column header jqGrid will send Ajax request to the server with the parameters sidx=colIndex1. So one can use index option to hold the name of the field in the database to simplify building of ORDER BY part of the corresponding SELECT statement.

In the most cases one need to use index property which is the same as name property. In case of usage datatype: "local" or in case of the usage datatype: "json" or datatype: "xml" togather with loadonce: true the data will be saved locally in the grid in data and _index internal options. In the case one need to use index values which are the values from name properties of colModel. In the cases it's strictly recommended don't specify any index property in colModel. In the case jqGrid will use name property instead.

like image 124
Oleg Avatar answered Oct 18 '25 05:10

Oleg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!