Release Notes
1.0 (Unreleased)
1.0 is the first release of jsgrid.
Compatibility with jqGrid 4.7.0
The following are the important changes since jqGrid 4.7.
Locales
All locale files are now encoded in UTF-8. File names are updated to use standard ISO language codes - this leads to the following changes:
- For Catalan
grid.locale-cat.jsbecomesgrid.locale-ca.js - For Chinese (Mainland China or Simplified)
grid.locale-cn.jsbecomesgrid.locale-zh-CN.js - For Chinese (Taiwan or Traditional)
grid.locale-tw.jsbecomesgrid.locale-zh-TW.js - For Danish the duplicae
grid.locale-dk.jshas been removed, usegrid.locale-da.jsinstead - For Korean
grid.locale-kr.jsbecomesgrid.locale-ko.js - For Portuguese (Brazil)
grid.locale-pt-br.jsbecomesgrid.locale-pt-BR.js - For Montenegrin
grid.locale-mne.jsbecomesgrid.locale-sr-ME.js - For Ukrainian
grid.locale-ua.jsbecomesgrid.locale-uk.js
If you've added any custom code to handle the incorrect language codes you'll need to remove this for this release.
Some common properties which have no relation to the language are moved to the grid.base.js module. Please note that this means that old locale files from jqGrid 4.7.0 will not work.
Changed Defaults
The default values of some jqGrid options are changed.
gridviewdefaults totrue: This improves the rendering performance. If you useafterInsertRowinstead ofcellatrandrowattr(which is very ineffective) in old projects, you will have to need to specifygridview: trueexplicitly.autoencodedefaults tofalse: The old defaultautoencode: falsecombined with JSON or local data produced strange side effects sometimes if the data contained symbols like&,;,>.heightdefaults to"auto": Improves the visibility of small grids or grids having a small number of rows.scrollOffset: 0is no longer required to remove free space which one sees on some grids without vertical scrollbars.rowNumnow uses a dynamic default value: The default valuerowNum: 20will be changed to 10000 (the value of the newmaxRowNumproperty) if no pager exists (i.e.pagerandtoppager: trueoptions are not used) or pagination is disabled (e.g. by settingtreeGrid: true). The new optionmaxRowNumcan be used to change the maximum value of rows displayed in the grid.datatypenow uses a dynamic default value: Ifdatais set or if nourlis set,datatypewill be initialized to"local". Ifdatais not used andurlis set,datatypewill be"json"if the input optionjsonReaderis used. For any other combination of input parameters the optiondatatypewill be set to"xml"to stay compatible with jqGrid 4.7.0 and older.editurldefaults to"clientArray": It allows local editing with minimal additional efforts.cellsubmitdefault to"clientArray": It allows local editing with minimal additional efforts.
Most of the changes correspond to recent tendencies of web development. Local JavaScript data and JSON data loaded from the server (especially in combination with loadonce: true) are used now much more frequently.
New Features
- Auto-adjustment of the column width based on column and header content: To use this feature, specify
autoResizable: truein the column (you can usecmTemplate: {autoResizable: true}to set the property for all columns). After that, a double-click in the resizer (in the column header close to vertical line between columns) will adjust the width of the column. You can useautoresizeOnLoad: trueto autoresize all columns havingautoResizable: trueproperty directly after loading/sorting/paging. - Configurable alignment of the column headers: See the description of the
colModelpropertieslabelAlignandlabelClassesbelow. - Better integration with alternative CSS frameworks: CSS is changed to simplify integration into projects which use frameworks other then jQuery UI, for example Bootstrap.
jsonmapworks with local data: The only exception is when you use thedataTypeOrgoption. The option will be set automatically after loading the data from the server and changing thedatatypeto"local". It allows you to usejsonmapfor the data loaded from the server and then skip it in later processing of the local data.- jqGrid can run without locale file: Content from
grid.locale-en.jsis included directly in the code. If you want to use a different default locale (or none at all), you can use the Download Builder - additional option
fromServer: truein.trigger("reloadGrid"): This allows reloading the data from the server whenloadonceis set totrue. - new
singleSelectClickModeoption: It allows to control deselection of previously selected rows on clicking on the row. Default behaviour is to toggle the selection. You can restore the previous behavior (i.e. disallow deselection) by specifyingsingleSelectClickMode: "selectonly"orsingleSelectClickMode: "". Note that the behaviour ofsetSelectionmethod is not changed. Multiple calls ofsetSelectionwill not deselect the row.
New Options
lastSelectedData: option for sorted and filtereddata. See the old answer for details. No "subclassing" of$.jgrid.fromis required anymore. The name of the internal optionlastSelectedis changed tolastSelectedData.widthOrg: Saves the value ofwidthduring creation of the grid. It will be used internally mostly to detect when jqGrid was created without specifying thewidthexplicitly. In this case, the width of the grid might be adjusted when the width of the columns changes.dataTypeOrg: Will be used internally when a remotedatatype("json"and"xml") is used together withloadonce: true. The option will be deleted by.trigger("reloadGrid").doubleClickSensitivity: The resizer will stay visible at least this long after the first click so that the user can click again, which will be detected as a double-click on the resizer. The default value is250(ms).autoresizeOnLoad: Used in combination with thecolModelpropertyautoResizable: true. IfautoresizeOnLoadistrue, then jqGrid auto-resizes all columns having theautoResizable: trueproperty directly afterloadComplete. Note: Auto-resizing of hidden grids doesn't work. So if you fill the grid on a hidden jQuery UI Tab for example, then you should callautoResizeAllColumnsmethod directly after the tab is activated.autoResizing: A map of properties (likegroupingView) used. It allows to tune some behaviour of auto-resizing.compact- default valuefalse. When set totrue, the width of the column header is calculated without reserving space for the sorting iconswidthOfVisiblePartOfSortIcon: default value12. Should be used only if you don't use the default jQuery UI icons.minColWidth:33- minimum width of column after resizingmaxColWidth:300- maximum width of column after resizingwrapperClassName:"ui-jqgrid-cell-wrapper"- the name of the class assigned to<span>included in every cell of the gridadjustGridWidth:true- means that the width of the grid will be adjusted after resizing the columnfixWidthOnShrink:false- will be removed later. It will be not included in the release
New colModel properties
template: "integer",template: "number", andtemplate: "actions"can be used to simplify the usage offormatter: "integer",formatter: "number"andformatter: "actions"incolModel. The list of the standard templates will be extended in future versions. You can use$.extend(true, $.jgrid.cmTemplate, { myDataTemplate: {...}}to define custom column templates which can be used like this:template: "myDataTemplate". See the post and the old answer for more information about column templates.autoResizablewhich will be used for auto-adjustment of the column width based on the column and header contentautoResizingOptionproperty is an object likeeditoptions,searchoptionsorformatoptions. It can be used to change some commonautoResizinggrid options for the column only. The properties ofautoResizingOptionareminColWidth,maxColWidthandcompact.labelAlignproperty with"left","center"(default),"right"and"likeData"values,labelClassesproperty allows to add CSS class to the column header.
New methods
setColWidth- allows changing the width of the column after the grid is created.autoResizeColumn- has no parameters. It resizes all columns havingautoResizable: trueautoResizeAllColumns- has integer iCol as parameter. It resizes all columns havingautoResizable: true. Note: Auto-resizing doesn't work with hidden grids.getGridComponent- allows to get different components of jqGrid like"bTable","hTable","fTable","bDiv"and others. The method will be extended later.
New Callbacks and Events
fatalError- callback which can be used to change the display of critical errors. One can use the feature in unit tests for example.resizeDblClickcallback andjqGridResizeDblClickevent will be called when double-clicking the column resizer. It's important to note that the callbacks will be called even ifautoResizableis set tofalsein thecolModel. It allows implementing custom actions on double-click on the column resizer. Returningfalseor"stop"from theresizeDblClickcallback or thejqGridResizeDblClickevent in case ofautoResizable: truewill prevent resizing on the column.- the callbacks
onShowHideColandonRemapColumnshave been added. The correspondingjqGridShowHideColandjqGridRemapColumnsevents already exist in jqGrid 4.7.
Some demos
- GetFilteredData - demonstrates how to use new
lastSelectedDataoption which returns, in contrast todata, filtered and sorted data items from all pages of jqGrid. Try to set some filter in the demo, make sorting by some column and set the page size to 2 for example. Click the button above the grid and see the displayed results. - autoResizing - demonstrates the default behaviour of auto-resizing feature. Double-click on the column resizer (in the header close to the right border which divides the columns). You will see the default behaviour of column resizing.
- autoResizingCompact - demonstrates the default behaviour of auto-resizing feature. Double-click on the column resizer (in the header close to the right border which divides the columns). You will see the behaviour of column resizing in case of usage
autoResizing: { compact: true }. - autoResizingWithShrinkCompact - modification of the previous demo. It uses no
shrinkToFit: falseoption andwidth: 518instead. - autoresizeOnLoad - demonstrates auto-resizing on loading. Try to use sorting, paging the grid, and see the results.
- autoresizeOnLoadCompact - the same demo as before (auto-resizing on loading), but with the usage of
autoResizing: { compact: true }additionally. - autoResizingPerformane1000 - the demo create the grid with 1000 rows. By double-click on resizer you can see the performance of resizing for relatively large number of rows.
- alignLabel - demonstrates the usage of new
labelAlignandlabelClassesproperties ofcolModel. - autoResizingGrouping - demonstrates then auto-resizing on loading works with grouping too.
- autoResizingGroupingRtl - the same as the previous demo, but it uses RTL.