Properties

The available properties are listed here, in alphabetic order. Some have more details described elsewhere, available by clicking on the link provided.

Property Type Description Default
altRows boolean Set a zebra-striped grid true
caption string Defines the Caption layer for the grid. This caption appear above the Header layer. If the string is empty the caption does not appear. empty string
cellEdit boolean Enables (disables) cell editing. See Cell Editing for more details true
cellsubmit string Determines where the contents of the cell are saved: 'remote' or 'clientArray'. See Cell Editing for more details 'remote'
cellurl string the url where the cell is to be saved. See Cell Editing for more details null
colModel array Array which describes the parameters of the columns. For a full description of all valid values see colModel API. empty array
colNames array Array which describes the column labels in the grid empty array
datastr string The string of data when datatype parameter is set to xmlstring or jsonstring null
datatype string Defines what type of information to expect to represent data in the grid. Valid options are xml - we expect xml data; xmlstring - we expect xml data as string; json - we expect JSON data; jsonstring - we expect JSON data as string; clientSide - we expect data defined at client side (array data) xml
deselectAfterSort boolean Applicable only when we use <>datatype : local<>. Deselects currently-selected row(s) when a sort is applied. true
editurl string Defines the url for inline and form editing. null
ExpandColumn string indicates which column (name from colModel) should be used to expand the tree grid. If not set the first one is used. Valid only when treeGrid option is set to true. null
forceFit boolean If set to true, and resizing the width of a column, the adjacent column (to the right) will resize so that the overall grid width is maintained (e.g., reducing the width of column 2 by 30px will increase the size of column 3 by 30px). In this case there is no horizontal scrolbar. Note: this option is not compatible with shrinkToFit option - i.e if shrinkToFit is set to false, forceFit is ignored. false
gridstate string Determines the current state of the grid (i.e. when used with hiddengrid, hidegrid and caption options). Can have either of two states: 'visible' or 'hidden' visible
hiddengrid boolean If set to true the grid initially is hidden. The data is not loaded (no request is sent) and only the caption layer is shown. When the show/hide button is clicked the first time to show grid, the request is sent to the server, the data is loaded, and grid is shown. From this point we have a regular grid. This option has effect only if the caption property is not empty and the hidegrid property (see below) is set to true. false
hidegrid boolean Enables or disables the show/hide grid button, which appears on the right side of the Caption layer. Takes effect only if the caption property is not an empty string. true
height string The height of the grid. Can be set as percentage or any valid measured value 150px
imgpath string Defines the path to the images that are used in the grid. Set this option without / at end empty string
jsonReader array Array which describes the structure of the expected json data. For a full description and default setting, see JSON Data
loadonce boolean If this flag is set to true, the grid loads the data from the server only once (using the appropriate datatype). After the first request the datatype parameter is automatically changed to clientSide and all further manipulations are done on the client side. The functions of the pager (if present) are disabled. false
loadtext string The text which appear when requesting and sorting data Loading...
loadui string This option controls what to do when an ajax operation is in progress.
  • disable - disables the jqGrid progress indicator. This way you can use your own indicator.
  • enable (default) - enables the red "Loading" message in the upper left of the grid.
  • block - enables the progress indicator using the characteristics you have specified in the css for div.loadingui and blocks all actions in the grid until the ajax request is finished. Note that this disables paging, sorting and all actions on toolbar, if any.
mtype string Defines the type of request to make ("POST" or "GET") GET
multikey string This parameter have sense only multiselect option is set to true. Defines the key which will be pressed when we make multiselection. The possible values are: shiftKey - the user should press Shift Key altKey - the user should press Alt Key ctrlKey - the user should press Ctrl Key empty string
multiboxonly boolean This option works only when multiselect = true. When multiselect is set to true, clicking anywhere on a row selects that row; when multiboxonly is also set to true, the row is selected only when the checkbox is clicked (Yahoo style). false
multiselect boolean If this flag is set to true a multi selection of rows is enabled. A new column at left side is added. Can be used with any datatype option. false
prmnames array Customizes names of the fields sent to the server on a Post: default values for these fields are "page", "rows", "sidx", and "sord". For example, with this setting, you can change the sort order element from "sidx" to "mysort":
prmNames: {sort: "mysort"}
The string that will be posted to the server will then be
myurl.php?page=1&rows=10&mysort=myindex&sord=asc
rather than
myurl.php?page=1&rows=10&sidx=myindex&sord=asc
none
postData array This array is passed directly to the url. This is associative array and can be used this way: {name1:value1...}. See API methods for manipulation. empty array
resizeclass string Assigns a class to columns that are resizable so that we can show a resize handle only for ones that are resizable grid_resize
scroll boolean Creates dynamic scrolling grids. When enabled, the pager elements are disabled and we can use the vertical scrollbar to load data. This option currently should be used carefully on big data sets, since I have not developed an intelligent swapper, which means that all the data is loaded and a lot of memory will be used if the dataset is large. You must be sure to have a initial vertical scroll in grid, i.e. the height should not be set to auto. false
scrollrows boolean When enabled, selecting a row with setSelection scrolls the grid so that the selected row is visible. This is especially useful when we have a verticall scrolling grid and we use form editing with navigation buttons (next or previous row). On navigating to a hidden row, the grid scrolls so the selected row becomes visible. false
sortclass string the class to be applied to the currently sorted column, i.e. applied to the th element grid_sort
shrinkToFit boolean This option describes the type of calculation of the initial width of each column against with the width of the grid. If the value is true and the value in width option is set then: Every column width is scaled according to the defined option width. Example: if we define two columns with a width of 80 and 120 pixels, but want the grid to have a 300 pixels - then the columns are recalculated as follow: 1- column = 300(new width)/200(sum of all width)*80(column width) = 120 and 2 column = 300/200*120 = 180. The grid width is 300px. If the value is false and the value in width option is set then: The width of the grid is the width set in option. The column width are not recalculated and have the values defined in colModel. true
sortascimg, sortdescimg string Links to image url which are used when the user sort a column sort_asc.gif, sort_desc.gif
sortname string The initial sorting name when we use datatypes xml or json (data returned from server) none (empty string)
sortorder string The initial sorting order when we use datatypes xml or json (data returned from server) asc
toolbar array This option defines the toolbar of the grid. This is array with two values in which the first value enables the toolbar and the second defines the position relative to body Layer. Possible values "top" or "bottom" [false,"top"]
treeGrid boolean Enables (disables) the tree grid format. For more details see Tree Grid false
tree_root_level numeric Determines the level where the root element begins when treeGrid is enabled 0
url string The url of the file that holds the request null
userData array This array contain custom information from the request. Can be used at any time. empty array
width number If this option is not set, the width of the grid is a sum of the widths of the columns defined in the colModel (in pixels). If this option is set, the initial width of each column is set according to the value of shrinkToFit option. none
xmlReader array Array which describes the structure of the expected xml data. For a full description refer to Data Types. {
   root: "rows",
   row: "row",
   page: "rows>page",
   total: "rows>total",
   records : "rows>records",
   repeatitems: true,
   cell: "cell",
   id: "[id]",
   subgrid: {
     root:"rows",
     row: "row",
     repeatitems: true,
     cell:"cell"
   }
}
$.jgrid.default array This array is used to define a grid option common to all jqGrids in the application. Typically, this is called once to set the default for one or more grid parameters -- any parameter can be changed. Typical implementation; $.extend($.jgrid.defaults,{rowNum:10}) empty array



See also

Events | Methods


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