Client-Side events and methods

jqGrid provides client-side javascript API that interacts with sorting. You can use that to control / force sorting on the client based on certain criteria.

Events

The event the fires on the client-side upon colunm sorting is called ColumnSort, e.g.

<trirand:JQGrid runat="server" ID="JQGrid1" DataSourceID="SqlDataSource1"> <ClientSideEvents ColumnSort="columnSort" /> </trirand:JQGrid>

Once defined in the grid, the event also needs to be defined as a javascript function. This particular event receives three parameters:

e.g.

function columnSort(fieldName, columnIndex, sortOrder) { var line = "<b>Column sorted</b>: " + fieldName + "; Index: " + columnIndex + "; sortOrder: " + sortOrder + "<br/>"; $("#log").append(line); }

Methods

jqGrid exposes the client-side sortGrid method with two parameters

e.g.

<script type="text/javascript"> function forceSort() { var grid = $("#<%= JQGrid1.ClientID %>"); grid.sortGrid("Freight", true); } </script>


  Last Updated: 11/2/2009 | © Trirand, 2009