Releases: dojo/dojo1-dgrid
v0.3.6
Breaking changes
OnDemandList's dgrid-refresh-complete event no longer includes rows
The rows property of this event was removed to match the implementation
added to the Pagination extension, which does not include it. If a particular
row is needed, it can be resolved from the QueryResults included on the event
via grid.row(...).element.
Significant changes
General/Core
- Added an index page to the test folder to browse the tests via a grid. (#407)
- Added a preliminary set of DOH tests to assist in spotting regressions. (#412)
Mixins
- The
Keyboardmixin has been made significantly more extensible (#429):- Added
keyMapandheaderKeyMapproperties, which are object hashes
whose keys are event key codes and whose values are functions to be
executed in the context of the instance; if not specified, defaults
(exposed viaKeyboard.defaultKeyMapandkeyboard.defaultHeaderKeyMap)
will be used. - Added
addKeyHandler(key, callback, isHeader)method for registering
additional keyboard handlers; this is usually easier than trying to
overridekeyMaporheaderKeyMap.
- Added
- The
Keyboardmixin no longer emitsdgrid-cellfocusoutand
dgrid-cellfocusinwhen spacebar is pressed. (#429)
Column Plugins
- The
editorcolumn plugin now emitsdgrid-editor-showanddgrid-editor-hide
events when an editor witheditOnset is shown or hidden, respectively. (#424) - The
editorcolumn plugin now adds adgrid-cell-editingclass to any cell
containing an active editor. (#442; thanks Brandano for the idea)
Extensions
Other changes and fixes
General/Core
- Fixed
Grid#styleColumn, which had broken in 0.3.5. (#408) - Fixed an issue with
Grid#cellspecific to when a cell object representing a
header cell was passed in. (#429) - The
Keyboardmixin now properly handles Home/End keypresses. - Fixed logic in
_StoreMixinto work around a
Dojo 1.8 bug withwhen, which
could inappropriately mutate the return value of_trackError. (#411) - Fixed logic in
OnDemandListso that asynchronous errors duringrefresh
are properly signaled via the promise it returns. (#411) - Added CSS to ensure that IE6 renders empty
OnDemandListpreload nodes with
0 height. (#429)
Column Plugins
- The
editorplugin now supports widgets returning object values by comparing
usingvalueOf. (#256, #304, #423) - The
treeplugin has been refactored to make use of theutil/has-css3
module, rather than feature-detecting upon first expansion. (#416) - The
treeplugin now implementsexpandsuch that it will bail out if the
target row is already in the desired state.
v0.3.5
Breaking changes
Signature of the newRow method
The newRow method in List, called in reaction to observed store changes,
has had its signature altered to match that of insertRow. Please note
that it is likely that newRow may be refactored out of existence in the future.
Grid and the columns property
The Grid module now normalizes the columns instance property to an object
even when it is passed in as an array. This means that any code written
which accesses grid.columns directly will break if it expects it to maintain
the array structure that was originally passed in.
To compensate for this, get("columns") retains the previous behavior - it
returns columns as initially passed, except in the case where subRows is
passed instead, in which case it returns an object hash version of the structure
keyed by column IDs.
put-selector version
When updating to dgrid 0.3.5, make sure you also update your version of
put-selector to 0.3.1 or higher
(0.3.2 is the latest at the time of this writing). If you use
cpm to update dgrid, this should happen
automatically.
Significant changes
General/Core
Listinstances will now clean up any styles added dynamically via the
addCssRulemethod; this also applies by extension toGrid#styleColumn
andColumnSet#styleColumnSet. This may cause a change in behavior in some
edge cases; the previous behavior can be obtained by passing
cleanAddedRules: falsein the constructor arguments object. (#371)- The
upanddownmethods ofListwill now callgrid.rowinternally to
resolve whatever argument is passed; theleftandrightmethods of
Gridwill callgrid.cell. (Formerly these methods only accepted a
row or cell object directly.) - The
Gridmodule now ensures that an object hash of the grid's columns is
always available (see Breaking Changes above); this fixes issues when
column IDs are explicitly set, but then couldn't be properly looked up
against thecolumnsarray. - The
Gridmodule now emits adgrid-sortevent when a sortable header cell
is clicked; this event includes asortproperty, and may be canceled to
stop the sort, or to substitute alternative behavior. In the latter case,
if updating the sort arrow in the UI is still desired, call the
updateSortArrowmethod and pass thesortvalue from the event. - The
OnDemandListmodule now supports apagingMethodproperty, which allows
specifying whether to throttle or debounce scroll events. The default
behavior has been changed from"throttleDelayed"to"debounce", which
generally is capable of far reducing the number of store queries issued,
moreso ifpagingDelayis increased (though its default remains the same). - The
OnDemandListmodule now supports akeepScrollPositionproperty, which
will attempt to preserve scroll position between refresh calls. This can be
set on the instance itself to affect all refreshes, or can be passed to the
refreshmethod directly for a specific call. - The
OnDemandListmodule now returns a promise from therefreshmethod,
which resolves when the grid finishes rendering results after the refresh.
It also emits adgrid-refresh-completeevent, which includes both a
reference to the QueryResults object (results) and the rendered rows
(rows). In addition, thedgrid-errorevent now fires more consistently
(both forOnDemandListandPagination).
Mixins
- The
Selectionmixin now supports anallowTextSelectionproperty, allowing
text selection within a List or Grid to be permitted or denied completely
independently from theselectionModeproperty; default behavior is still
to prevent unlessselectionModeisnone. Selection prevention itself
has also been fixed to work in all browsers. (#148)
Column Plugins
- Fixed a
treeregression since 0.3.2 involving only-child rows being misplaced
upon observed changes. (#353)
Extensions
- The
ColumnResizerextension now supports anadjustLastColumnflag; when
set totrue(the default, and previous behavior), this will adjust the
last column's width toautoat times where a column resize operation would
otherwise cause column widths to stretch due to how browsers render tables.
This can be set tofalseto purposely disable this behavior. - The
Paginationextension now returns a promise from therefreshand
gotoPagemethods, which resolves when the grid finishes rendering results.
Note that it does not (yet) emit an event likeOnDemandList. - The
Paginationextension now re-queries for the current page of data when
the grid is notified of a store modification which affects the number of
items currently rendered. (#283) - The
Paginationextension now supports ashowLoadingMessageproperty; by
default (true), a loading node will be displayed whenever a new page is
requested; if set tofalse, the grid will instead retain the previous
content until the new data is fully received and ready to render. (#219) - The
Paginationextension now includes localized strings for the following languages: - The
DijitRegistryextension now supports dgrid components as direct children
of common Dijit layout container widgets, and will now properly alter the
size of a list or grid if theresizemethod is passed an argument. (#401)
Other changes and fixes
General/Core
- Resolved an issue where upon changing column structure, the placement of the
sort arrow would be lost even though the grid is still sorting by the same
field. - Simplified logic in
Gridto always createtrelements. (#387) - Resolved an issue where
OnDemandListcould end up firing requests where
start exceeds total and count is negative. (#323) - Resolved issues regarding proper handling of errors / rejected promises in
OnDemandListas well as thePaginationextension.
(#351; obsoletes #241, #242) - Resolved potential memory leaks in
Grid,ColumnSet, andColumnResizer.
(#393, #394, #395, #396, #397) - Resolved issues in
Grid,ColumnSet,ColumnHider, andColumnResizer
regarding dynamic style injection for grids with DOM node IDs containing
unsafe characters; addedescapeCssIdentifierfunction toutil/misc. (#402) - Resolved an issue in
TouchScrollwhich unnecessarily prevented native
touch-scrolling even when the component can't be scrolled. (#344)
Mixins
- Resolved an issue with the
ColumnSetmixin where clicking within the
horizontal scrollbar area (aside from the arrows/handle) wouldn't work in IE.
(#307) - Improved logic of
isSelectforSelectionandCellSelectionregarding
unloaded rows/cells in combination with the select-all feature in some cases.
(#258)
Extensions
- Resolved an issue where
ColumnHiderwould leave styles applied for hiding
columns, which could have adverse effects if a new grid is later created
with the same ID. (#371) - Resolved an issue with
ColumnHiderwhich could cause the hidden state of
columns to be forgotten when other components such asColumnReorder
interact with the column structure. (#289) - Resolved an issue with
ColumnHiderrelated to IE8 standards mode's handling
ofdisplay: nonecells. (#362) - Resolved an issue where widths set via the
ColumnResizerextension would be
reset upon rearranging columns with theColumnReorderextension. - Resolved an issue in
ColumnResizerstyles which caused body and header cells
to skew in Chrome 19 and Safari 6. (#142, #370) - Changed name of private
_columnStylesobject used by theColumnResizer
extension to_columnSizesto reduce ambiguity. - The
Paginationextension will no longer immediately throw errors if it is
initialized without a store. However, a warning will be logged, and any
method calls will likely throw errors until a store is assigned. (#355)
v0.3.4
Significant changes
Extensions
- The
ColumnResizerextension now emits adgrid-columnresizeevent when a resize
occurs; if initiated by the user, the event will include aparentTypeproperty
indicating the type of event that triggered it. If this event is canceled,
the column will not be resized. (#320) - The
ColumnResizerextension now honors awidthproperty included on column
definition objects for the purpose of initializing the width of a column; this
can be useful if it is desired to persist and restore custom column widths
from a cookie or other local storage. (#321) - The
ColumnResizerextension now honors aresizableproperty included on
column definition objects for the purpose of disallowing resize of specific
columns. (#325)
Other changes and fixes
General/Core
Mixins
- The
ColumnSetmixin now supports horizontal mousewheel events. (#239)
Column Plugins
- The column plugins (
editor,selector, andtree) can now be invoked without
a column definition object at all, if no properties need to be set. This
is mostly useful forselector. (#324) - Fixed an issue with the
selectorplugin when a column definition lacks a
labelproperty. (#324) - Always-on
editorcolumns now honor thecanEditfunction on column definitions
at the time each cell is rendered. - Always-on
editorcolumns now properly revert values if thedgrid-datachange
event is canceled. (#252)
Extensions
- The
ColumnResizerextension's resize indicator now follows the cursor
even when dragging beyond the grid's boundaries, and reacts if the mouse
button is released even outside the boundaries of the browser window. (#310)
v0.3.3
Breaking changes
- The
Keyboardmodule'sdgrid-cellfocusinanddgrid-cellfocusoutevents
now report either aroworcellobject, depending on whether
cellNavigationisfalseortrue, respectively. (Formerly these events
always contained acellproperty pointing to the DOM node that fired the event.) - Several mixin and extension modules have had their
declarehierarchies
simplified under the expectation that they will always be mixed in as
documented, and never be instantiated directly. To be clear, this will not
break any code that is written as prescribed by the documentation.
Significant changes
- All custom events fired by dgrid components now report the following properties:
grid: The dgrid instance which fired the event.parentType: If the event was fired in direct response to another event,
this property reflects the type of the originating event. If the event
was fired due to a direct API call,parentTypewill not be defined.
- The
ColumnReorderextension now fires adgrid-columnreorderevent when
a column is reordered via drag'n'drop. Note that this event always reports
aparentTypeof"dnd"(there is no way to trigger this event directly
from an API call). - The
Paginationextension now exposes and references its i18n strings via the
i18nPaginationinstance property, allowing these strings to be overridden.
(#225)
Other changes and fixes
General/Core
- Fixed an issue with the
upanddownmethods inListand theleftand
rightmethods inGrid, which could cause them to attempt to traverse
outside the list/grid in question. - Fixed an issue in the observer code in
Listwhich could cause an updated
row to render out-of-sequence whentreeis used. (#154) - Fixed an issue that could cause old IE to throw errors due to an undefined
parameter toinsertBefore. (#308) - The
_StoreMixinmodule now shows/hides a node displayingnoDataMessagein
reaction to the last row being removed or first row being added. (#229) - The
OnDemandListmodule now adheres more strictly to themaxRowsPerPage
property. To accommodate this, the default has been increased from100to
250. (#280) - The
OnDemandListmodule's default value forfarOffRemovalhas been
lowered from10000to2000. - The
loadingMessageproperty (referenced byOnDemandListand thePagination
extension) now supports HTML strings, likenoDataMessage(#312) - The CSS for one of the
util/has-css3module's tests has had its class renamed
to prevent conflicting with users of Modernizr. (#313)
Mixins
- The
Selectionmixin in single-selection mode now properly allows reselecting
a row that was deselected immediately prior. (#295)
Extensions
v0.3.2
Breaking changes
GridFromHtml and OnDemandGrid
The GridFromHtml module no longer automatically mixes in the OnDemandGrid
module, mixing in only Grid instead, in order to support the option of using
alternative store-backed mechanisms such as the Pagination extension.
This may cause existing code which relied on GridFromHtml and loaded from a
store to break. Such cases will now need to mix in OnDemandList manually
(they don't need to mix in OnDemandGrid, since Grid is still inherited by
GridFromHtml).
There are a couple of ways to deal with this. In Dojo 1.8, when parsing dgrid
instances declaratively, the new data-dojo-mixins attribute can be used to
mix OnDemandList into GridFromHtml:
<table data-dojo-type="dgrid/GridFromHtml" data-dojo-mixins="dgrid/OnDemandList" data-dojo-props="...">
...
</table>In the case of Dojo 1.7, dojo/parser doesn't understand module IDs, and so a
global reference to the dgrid components used is needed. Changing such code to
mix in OnDemandList involves nothing more than an additional use of declare:
<table data-dojo-type="dgrid.OnDemandGridFromHtml" data-dojo-props="...">
...
</table>
...
<script>
var dgrid = {}; // declared in global scope
require(["dojo/_base/declare", "dojo/parser", "dgrid/GridFromHtml", "dgrid/OnDemandList", ..., "dojo/domReady!"],
function(declare, parser, GridFromHtml, OnDemandList, ...) {
// Create dgrid constructor with necessary components, available in the global scope.
dgrid.OnDemandGridFromHtml = declare([GridFromHtml, OnDemandList]);
// Parse the document, now that the above constructor is available.
parser.parse();
});
</script>Significant changes
General/Core
- All dgrid components now have
scrollToandgetScrollPositionmethods,
either inheriting fromTouchScroll(see below) or implemented inList
based onscrollTopandscrollLeft. Updates have been made to dgrid
components where necessary to leverage these methods. - All dgrid components now respond to
set("showFooter")consistently with
set("showHeader"). (#284) - It is now possible to initialize or later set CSS classes on a dgrid component's
top DOM node via"class"orclassName. (#183) _StoreMixin(used byOnDemandListand thePaginationextension) now
includes a reference to the grid instance in emitteddgrid-errorevents
(via agridproperty on theerrorobject).- The
TouchScrollmodule has undergone significant changes and improvements:- uses CSS3
translate3dto take advantage of hardware acceleration- a
util/has-css3module has been added with has-feature tests to
detect CSS3 features to be used byTouchScroll
- a
- implements increased tension and bounce-back beyond edges
- displays scrollbars as appropriate while scrolling
- implements
scrollToandgetScrollPositionmethods to allow manipulation
and retrieval of scroll information based on CSS transformations - allows configuring how many touches are necessary to activate scrolling,
via thetouchesToScrollproperty
- uses CSS3
Mixins
- The
ColumnSetmixin now defines astyleColumnSetmethod, which is
analogous to Grid'sstyleColumnmethod, but instead adds a style rule for
the class on nodes containing the entire columnset contents for a row. - The
Keyboardmixin now definesfocusandfocusHeadermethods, for
programmatically focusing a row or cell (depending on the value of the
cellNavigationsetting). (#130)
Column Plugins
- The
treecolumn plugin now supports acollapseOnRefreshproperty in the
column definition; if set totrue, it will cause all parent rows to render
collapsed whenever the grid is refreshed, rather than remembering their
previous state. - The
treecolumn plugin now supports aallowDuplicatesproperty in the
column definition; this can be set totrueto allow for cases where the same
item may appear under multiple parents in the tree. Note however that it
limits the capabilities of therowmethod to the top level only. (#147)
Extensions
- A
CompoundColumnsextension has been added, which allows defining column
structures which include additional spanning header cells describing the
contents beneath. - The
ColumnHiderextension has undergone some refactoring to make it more
extensible and to provide a public API for toggling the hidden state of a
column, via thetoggleColumnHiddenState(columnId)method. - The
ColumnReorderextension has been refactored to allow reordering of
columns within the same subrow or columnset in more complex column structures,
in addition to the previous ability to reorder columns in simple single-row
structures. - The
DnDextension now properly supports touch devices when used with Dojo 1.8. - The
DnDextension now supports specifying agetObjectDndTypefunction, for
customizing the DnD type reported for each item rendered.
Other changes and fixes
General/Core
- Several accessibility issues have been addressed, including fixes to the
roles reported by certain elements, and labels added to the Pagination
extension's controls. (Partly attributed to #273) Grid: calls tocellwith a falsycolumnIdvalue now work properly. (#198)- Fixed an issue with dgrid instances not reacting correctly to window resize.
- Fixed an issue affecting odd/even row classes on in-place updates. (#269)
- Fixed a rendering issue involving confusion of preload node dimensions. (#161)
- Fixed an issue causing
treelevel indentation to render improperly when used
with thePaginationextension. - Fixed a deprecated API call in
_StoreMixin. (#272) - Improved logic in
OnDemandListto properly account for lists with displays
which tile items usingdisplay: inline-block.
Mixins
- The
ColumnSetmixin now behaves properly when calling
set("columnSets", ...). (#202) - The non-standard
colsetidattribute assigned to nodes by theColumnSet
mixin has been replaced with thedata-dgrid-column-set-idattribute. - The
Selectionmixin will now properly reset_lastSelectedwhen
clearSelectionis called. (#175) - The
Selectionmixin will now wait untilmouseupwhen handling mouse events
on targets that are already selected. (#251)
Column Plugins
- The
expandmethod defined by thetreecolumn plugin will no longer
be called at all in reaction to events on rows which report no children.
Extensions
- The
ColumnHiderextension now supports settinghiddenandunhidable
together, resulting in the column being hidden and not being present in the
popup menu (but it can still be shown programmatically). (#199) - The
ColumnHiderextension now behaves appropriately for columns with no
labeldefined. (#244) - A number of protected members in the
ColumnHiderextension have been renamed:_toggleColumnStatehas been replaced by_setColumnHiddenStateand the
public APItoggleColumnHiddenStatementioned above_toggleHiderMenuhas been renamed to_toggleColumnHiderMenu_columnStyleRuleshas been renamed to_columnHiderRules
- An issue with the
ColumnResizerextension which could cause distortion of
width values on the first resize has been fixed. (#291) - The
DnDextension can now drag non-root tree items in Dojo 1.8 only by
passingallowNested: trueto the source viadndParams. (#68) - The
DnDextension now behaves better with regard to synchronizing with
dgrid'sSelectionmixin, and also with regard to dragging when some selected
nodes are no longer in the DOM. (#185, #246) - The
DnDextension now adds CSS to adequately override spurious styles which
can leak in from dijit.css in Dojo 1.8. (#255)
v0.3.1
Significant changes
- Column plugins can now define the following functions on column definitions,
providing more opportune timing for initialization and tear-down:init, which will be executed at the time the grid's column configuration
is (re-)applieddestroy, which will be executed when the grid is destroyed, as well as
before a new column configuration is applied
- The
treeplugin now supports the following column definition properties:shouldExpand(row, level, previouslyExpanded), a function providing for
conditional automatic expansion of parent rows (#141)indentWidth, an integer specifying the size (in pixels) of each level's
indent (note that the default is now9, though it was previously19)renderExpando(), a function which can replace the default logic for
rendering the expando node (the arrow next to the content of each cell)
- The
editorplugin now augments the grid instance with anedit(cell)method
which can be used to programmatically activate the editor in a given cell. - A
util/mousemodule has been added, which exposes simulated events for
the mouse entering and leaving grid rows and cells. (#165) - A
package.jshas been added in order to streamline the build process.
package.jsonhas been updated to reflect the presence ofpackage.jsand
reference the latest versions of xstyle and put-selector, each of which now
have apackage.jsof their own.
Other Fixes
- Mouse events for expanding/collapsing rows in tree grids should be a bit more
reliable. (#112) - Rows expanded in a tree grid which has been started up but is currently hidden
will now be rendered properly when re-shown. (#140) - The
treeandeditorplugins can now both be used on the same column, by
wrappingeditorwithtree. (#144) sortablenow defaults tofalsefor columns wherefieldis"_item"
or entirely unspecified (in which case there's nothing to sort by anyway).
(#149)- The
Paginationextension now behaves appropriately with empty result sets.
(#173) - The
ColumnHiderextension now iterates oversubRowsrather thancolumns,
making it a bit more reliable in general. (#164) - A couple of issues with the
DijitRegistryextension were identified and
fixed. (#146, thanks jdohert)
v0.3.0
General
column plugin names are now lowercase
Formerly, column plugins and the named arguments storing their module return values
had their first letter capitalized. However, given that these plugins are in
fact simply functions which modify (and return) their first passed argument,
and are not in fact constructors, their nomenclature has been amended to
all-lowercase to avoid confusion, and to further convey that they are intended
to be run without the new keyword.
When running on a case-insensitive filesystem (e.g. Windows, or Mac OS X by
default), this change likely won't have any immediate visible effect on
existing code which requests the module with an initial capital letter.
However, revising code to reference the all-lowercase module ID is encouraged.
new TouchScroll implementation
The TouchScroll module provides touch-event-based scrolling for dgrid
components on touch devices. Originally this module was borrowed from a
snapshot of a dojox/mobile module, but this implementation blocked several
dgrid features from working correctly on touch devices.
That module has been replaced by a new barebones implementation written from the
ground up. Further development on this module is likely to occur.
additional extensions
The following extensions have been added since v0.2:
- ColumnReorder: allows reordering columns in simple grids via DnD
- ColumnHider: allows dynamically hiding/showing grid columns from a simple menu
- Pagination: adds controls for discrete pagination
CSS
column- and columnset-* classes now prefixed with dgrid-
The column-<id> classes added by the Grid module, and the columnset-*
classes added by the ColumnSet mixin, have been renamed to include the dgrid-
prefix like most other classes automatically added by dgrid components.
The main exception is the field-<field> classes, which are intentionally not
namespaced in this fashion, as they are thought to be more applicable to the
particular use-case and less applicable to the dgrid components themselves.
In the overwhelming majority of cases, it is recommended to style using the
.field-<field> classes (or, if a className is specified in the column
definition, use that as it overrides the .field-<field> class).
ColumnResizer: handle node class is now dgrid-resize-handle
The class on the resize handle node added to each header cell by the
ColumnResizer extension was formerly dgrid-resize-handler; this has been
corrected to dgrid-resize-handle.
List
While these changes relate particularly to code in List.js, note that the changes
essentially affect all dgrid components, since all components extend from or
mix into List.
new: get and set methods
Central get and set functions have been implemented, somewhat akin to the
interfaces seen in dojo/Stateful and dijit/_WidgetBase. However, there are
some key differences:
- dgrid supports custom getters and setters, but they are named following the
pattern of_getFooand_setFoo, unlike Dijit's_getFooAttrand_setFooAttr. watchis not implemented.
Most set* functions found throughout dgrid components are now implemented
as custom setters, and should thus be accessed via the central set method.
For example, setQuery(...) is now set("query", ...). Deprecation stubs
are currently in place for the old APIs, but will be removed in the future.
sortOrder property and sort function replaced by getter/setter
Previously, sortOrder was the (arguably internal) instance property used to
store the current sort options. Sort code has since been rearranged; the new
recommended way to retrieve existing sort options is to call get("sort").
Meanwhile, the sort method has been deprecated in favor of set("sort", ...).
Sort order can also now be initially defined when creating a list or grid by
specifying a sort property in the object passed to the constructor.
Grid
columndef.get function now takes one parameter
The get function on column definitions is now passed only one argument: the
object for the row in question.
Earlier, the object was the second parameter, in order to match the signature of
the same function in dojox grid components. However, the first parameter did
absolutely nothing in dgrid, and has now been removed.
_StoreMixin (OnDemandList/OnDemandGrid, Pagination)
new: columndef.set function
Store-backed grids now support a set function on the column definition object.
Like get, this function receives an object, which contains the updated item as
it will be put into the store. The function may return a value to replace the
value in the field represented by the column.
Additionally, since the object passed to the function is the
object that will be put, it is possible to perform more complex
transformations by modifying the object directly; in this case, the function
may elect not to return anything. Note, however, that this approach should
be used sparingly and carefully, since it is possible to do anything to the
item, and complications may develop if multiple columns in the same grid take
this approach.
new: updateDirty
Store-backed grids also now have an updateDirty(id, field, value) method,
which can be used to update dirty state of items represented in the grid.
(On master this was previously known as setDirty, but did not exist in v0.2.)
Selection / CellSelection
dgrid-select and dgrid-deselect events
The behavior and signature of selection events has changed significantly.
- When a range is selected, instead of firing many individual events for each
affected row/cell, a single batched event will be fired. - These events now include a
rowsorcellsproperty yielding an array of objects,
rather than aroworcellproperty yielding a single object. - Deselect events will now fire when rows are removed, or if a refresh occurs
which resets the grid's selection.
new: allowSelectAll property, disabled by default
Previously, checkbox selectors provided the ability to select all rows.
This ability is still provided, but is now determined by the value of the
allowSelectAll property.
Note, however, that this property defaults to false. This feature is not
needed in all use cases, and its implications should be considered beforehand,
especially with regard to the lazy-loading nature of store-backed lists and grids.
Additionally, it is now possible to use Ctrl+A or Cmd+A to toggle between
selecting all items and selecting no items.
new: allowSelect method
Selection now exposes an allowSelect method on the instance. This method
receives a row object (or a cell object in the case of CellSelection) and
is expected to return true or false, reflecting whether selection of this
row or cell should be permitted.
This is particularly useful in conjunction with the selector column plugin,
which will display a disabled checkbox or radio button as appropriate.
new: deselectOnRefresh property
Previously, the Selection module would clear the selection whenever a list
or grid is refreshed. While this is still the default, the behavior can now
be disabled by setting deselectOnRefresh to false.
selector
columndef.type is now columndef.selectorType
In dgrid 0.2, the selector type (generally either "checkbox" or "radio")
could be specified within the column definition object via the type property.
This has been changed to selectorType to avoid ambiguity. The selector type
can also be specified as the second argument to the selector column plugin
function instead, as before.
editor
The editor column plugin has been significantly refactored since v0.2.
The most notable changes in terms of API effects are noted below.
widgetArgs property is now editorArgs
The widgetArgs property supported in the column definition by the editor
plugin has been renamed to editorArgs to be agnostic as to whether the
editor is a widget or a standard input, leaving the door open for usage with
standard HTML input types.
editorArgs cannot be specified as a function
Previously, it was possible to specify widgetArgs as a function instead of an
object. The function would receive a store item and be expected to return an
object hash to pass to the widget constructor each time an editor is rendered.
This capability was rarely useful, and is no longer viable, particularly due to
how editors now behave when editOn is specified: the editor component is only
constructed once, rather than every time a cell is activated for editing.
Thus, widget properties may only be specified directly via an object hash to
the editorArgs property. For more advanced cases where the value needs to be
computed or transformed on a per-item basis, use the get function in the
column definition object to return the appropriate data.
dgrid-datachange event properties
The dgrid-datachange event emitted by the editor column plugin now includes
a cell property, which contains the same data retrievable via
grid.cell(event). Since grid.cell is already called in the relevant
editor code, it is exposed directly on the event to avoid forcing developers
to perform the same lookup again on the other end.
Since it is possible to get cell and row information from this property,
the previously-exposed rowId property of the dgrid-datachange event is
now deprecated and will be removed in a future release.
The dgrid-datachange event also now includes a grid property containing a
reference to the Grid instance from which the event was fired.
tree
expand method added to grid instance
Tree columns now add an expand(row, expand) method to their parent grid,
for programmatically expanding or collapsing grid rows. See the documentation
for details.