-
Notifications
You must be signed in to change notification settings - Fork 197
SMALL improvements in the usage of jqGrid
There are many standard problems and typical errors of newcomers in the usage of jqGrid. One of the goal of free jqGrid 4.8 was to simplify the usage of jqGrid and to reduce restrictions and to probability of the errors. It will be tried to find a compromises between the possibly good compatibility with the previous versions of jqGrid and still simplifying of the usage.
One don't need to include grid.locale-en.js
if one need to use en-US locale. All required settings are included already in jquery.jqGrid.min.js
(jquery.jqGrid.src.js
).
jqGrid required to have unique id
attribute assigned to the base <table>
element of the grid. If the <table>
have no such id
then jqGrid assign it automatically.
It's allowed to use pager: true
option. It create automatically the empty <div>
an generate unique id
to it. After creating of jqGrid the value of pager
option will be modified from true
to the id selector of the pager div. So one can use getGridParam
to get the value if it's required. The behavior of pager: true
option is very close to behavior of toppager: true
option which is long supported in jqGrid to create top pager. It is possible to us both pager: true
and toppager: true
to create two pagers: one on the top of the grid and another one on the bottom of the grid.
-
height: "auto"
are used now instead ofheight: 150
used before. It improves the visibility of small grids or the grids having small number of rows. NoscrollOffset: 0
are required to remove unneeded free space which one sees on some grids which have no vertical scrollbar. If one want to hold the old 150 value one need to includeheight: 150
option explicitly. -
gridview: true
are used as default with the only exception:afterInsertRow
callback are defined. The usage ofgridview: true
improves performance of rendering of the grid. In case of usageafterInsertRow
in old projects instead of much more effectivecellattr
,rowattr
or custom formatters one will have backward compatibility. -
editurl: "clientArray"
are use now instead ofediturl: null
used before. It allows to use local editing without minimal additional efforts and the requirement to have any server part implemented. -
cellsubmit: "clientArray"
are use now instead ofcellsubmit: "remote"
used before ifcellurl
is undefined.
-
dynamic default value is used now for the
datatype
option. If one uses input optiondata
or if one don't specified anyurl
option, then undefineddatatype
will be initialized to"local"
. If one uses nodata
option and specifiesurl
option then one initializesdatatype
to"json"
if the input optionjsonReader
are used. In case of usage any other combinations of input parameters the optiondatatype
will be set to"xml"
to stay the mostly compatible to jqGrid 4.7.0 and older. -
dynamic default value is used now for
rowNum
option. The default valuerowNum: 20
will be changed to10000
(the value of the newmaxRowNum
property) if no pager exists in jqGrid (nopager
andtoppager: true
option are used) or if one uses jqGrid option, which switches off the pagination (liketreeGrid: true
). New jqGrid optionmaxRowNum
can be used to change the maximal value of rows displayed in the grid from default value10000
to another value. By the way jqGrid allow now to specifyrowNum: 0
orrowNum: 0
. In the case jqGrid replaces therowNum
value tomaxRowNum
during initialization of the grid.
jqGrid 4.7 and earlier don't support the usage of datatype: "local"
, but it's known the trick which allows to do almost the same using datatype: "jsonstring"
. jqGrid uses the same trick and changes the input options datatype: "local"
and input data
option to datatype: "jsonstring"
and datastr
option. It simplify the usage of local TreeGrid.