Context of general and event based callbacks has been changed from DOM reference to widget instance.
So instead of writing $(this).pqGrid( 'method_name', params );
, you can directly write
this.method_name( params );
inside the callbacks.
Event names have been changed to widgetName:eventName
. e.g.,
to listen to DOM based beforeSort event of grid, the new syntax is $( selector ).on( "pqGrid:beforeSort", .. )
instead of $( selector ).on( "pqgridbeforesort", .. )
Firing of DOM based events and their bubbling have been disabled by default for performance reasons.
Firing of DOM events can be enabled by setting the option trigger: true
of the widget.
Similarly bubbling of DOM events can be enabled by setting the option bubble: true
of the widget.
This version introduces new lightweight events which are faster and easy to use.
Equivalent syntax to listen to beforeSort event is instance.on( 'beforeSort', function( evt, ui ){ } )
.
We recommend to use these events unless necessary otherwise.
column.render
and header cell rendering.
There have been following changes in the API.
checkBoxSelection
has been changed to checkbox
column.editor
has to be set to false instead of column.editable
.
beforeunCheck
and unCheck
events have been removed.
Instead beforeCheck
and check
events are fired
during both unchecking and checking.
cb.select
column.dataType
is mandatory for checkbox columns unless it's a string dataType.
Selections have also received significant upgrades in this version to support column selections, make them fast and easy to manipulate. As a result some methods have been removed from factory selection method as noted in the API and two new prototype based objects Range and Selection have been introduced.
Support to maintain cell selections upon data changes in the grid and to select non-contiguous areas of cells has been dropped.
These 3 methods now support multiple rows so that multiple rows can be added, updated, deleted through a single method call.
It's important to pass focusInvalid: true
to isValid()
method when
it's required to stop further validation and focus on first invalid cell.
There is a new global namespace i.e., pq
used by the PQ library and widget instances can be created using constructors
available on this namespace. e.g.,
var instance = pq.grid( ".selector", options );
So due care should be taken not to overwrite the namespace.