Properties, Events and Methods

Properties

Several properties of the grid govern the function and appearance of the Navigation bar:

Property Type Description Default
firstimg string Link to image url for the first button first.gif
lastimg string Link to image url for the last button last.gif
nextimg string Link to image url for the next button next.gif
page integer The requested initial page number when we use datatypes xml or json (data returned from server) 1
pager DOM element or string Sets the pager bar for the grid. Must be a valid html element. If the element has class “scroll”, then the width is equal to the grid. Usage:
If parameter is a DOM element, jQuery("#mypager");
if using a string, "mypager", where mypager is the id of the pager. Note the missing "#"
pgbuttons boolean Disables or enables pager buttons, if pager is present true
pginput boolean Disables or enables the input box for current page, if pager is present true
pgtext string Text that appear before the number of total pages "/"
previmg string Link to image url for the previous button prev.gif
recordtext string Displays the text associated with the display of total records; specified value must be in quotes. "Rows"
rowList array This parameter constructs a select box element in the pager in which the user can change the number of the visible rows. empty array
rowNum integer The initial number of rows that are be returned from the server 20
viewrecords boolean Display the total records from the query in the pager bar false

Events

One event of the grid ralates to the Navigation bar:

Event Parameters Description
onPaging pgButton This event fires after click on [page button] and before populating the data. Also works when the user enters a new page number in the page input box (and presses [Enter]). pgbutton(string) can be - first,last,prev,next

Methods

The only methods we need are to invoke the pager itself and to add custom buttons, if necessary

Method Parameters Returns Description
navGrid pager_id, parameters jQuery object accepts the following settings to govern which buttons appear on the Navigation bar; any of them may be set to true or false. The default for all is true, but may be changed by, for example
{refresh: true, edit: true, add: true, del: false, search: true}
or
{del: false}
The position of these buttons is controlled by a position setting (the default is left):
{add:false,del:false,edit:false,position:"right"}
Parameters for these buttons can be sent by adding them after the main array:
...{add:false,edit:false,del:false},
	{}, // edit parameters
	{}, // add parameters
	{reloadAfterSubmit:false} //delete parameters
navButtonAdd jQuery object supports adding custom buttons. This method must be chained with the setting of the Standard Buttons. See details and examples in Custom Buttons



  Last Updated: 2/22/2009 | © Tony's jqGrid - a jQuery Plugin, 2010