v0.4.0
dgrid 0.4 brings several significant changes and improvements from 0.3. However, several of these changes are not backwards-compatible. Briefly, the most notable changes are as follows:
- Dojo 1.8+ required
- IE < 8, Presto-based Opera, and quirks mode no longer supported
- Interacts with dstore instead of dojo/store
- Column plugins are now mixins
- APIs previously marked as deprecated have been removed
- Various APIs have been modified to be more straightforward
- Added Bower support
- Tests upgraded to use Intern 2 and Leadfoot
Details on each of these points are provided below. Further details and examples on updating code to migrate from dgrid 0.3 to 0.4 are available in the 0.4 Migration Guide.
Breaking Changes
General
Changes to browser and Dojo version support
dgrid 0.4 no longer supports IE 6 and 7, quirks mode, and Presto-based Opera. Any previously-existing support for these platforms/modes has been removed to reduce code size.
Given that dgrid 0.4 depends on dstore, and dstore requires Dojo 1.8 or higher, dgrid now requires Dojo 1.8 or higher as well (as opposed to previous versions which also supported 1.7).
Full information on supported platforms and Dojo versions is listed in the README.
dojo/store replaced with dstore
dgrid 0.4 interfaces with the dstore API, the next evolution in Dojo store APIs. dstore's APIs solve various problems that were encountered in dojo/store
, especially around observable stores.
dstore provides an adapter in order to allow dstore consumers to interface with dojo/store
stores.
Column plugins are now mixins
Each of the three column plugins (editor
, selector
, and tree
) have been converted to mixins, to make them easier to extend and less prone to user error.
- The converted mixins now begin with uppercase letters to represent that they are mixins to be used with
declare
, not functions which modify a column definition object - Each mixin's functionality is still controlled on a per-column basis:
Editor
looks for presence of theeditor
propertySelector
looks for theselector
property (which replacesselectorType
)Tree
looks for therenderExpando
property (which can be a function ortrue
for the default rendering)- Note that
Tree
assumes that only one column will contain this property - Several column definition properties have been moved to instance-level:
collapseOnRefresh
,treeIndentWidth
(formerlyindentWidth
),shouldExpand
, andenableTreeTransitions
(formerlyenableTransitions
)
- Note that
See the 0.4 Migration Guide for usage examples.
APIs
List#renderArray no longer handles stores
List#renderArray
no longer contains logic dealing with store query results; its logic now strictly concerns rendering arrays of data. Query result logic is located in _StoreMixin#renderQueryResults
, which eventually calls renderArray
.
This separation simplifies the process of extending renderArray
, as it never needs to deal with a promise. It also makes the base List
component significantly more lightweight.
List#newRow replaced by List#highlightRow
Previously, List#newRow
would call insertRow
then highlight the inserted row for a period of time. That logic has been refactored into a highlightRow
method, which can be used to highlight a row at any time. (Rows are still highlighted when changes are observed in a store, just as before.)
Grid.defaultRenderCell moved to prototype
The default renderCell
implementation is now exposed as Grid#_defaultRenderCell
, which allows it to be more easily reused and extended. Note that it is still called in the context of a column, not the grid itself. (#375)
TouchScroll no longer loaded automatically
In dgrid 0.3, the dgrid/TouchScroll
module would be loaded for any device supporting touch events. As touch scrolling support in mobile browsers has improved, this became less necessary, and in some cases, actually problematic.
As a result, in dgrid 0.4, the TouchScroll
module is no longer loaded automatically. If you still wish to use it, you must load it and mix it in explicitly.
Removed APIs
- All previously-deprecated
setFoo
-style methods have been removed in favor ofset('foo', ...)
dgrid-refresh-complete
event'sresults
property has been removed, due to changes made for dstore integrationdgrid-error
event'serror.grid
nested property removed; obsoleted bygrid
property directly on eventdgrid-datachange
event'srowId
property has been removed, after being deprecated in 0.3; useevent.cell.row.id
insteadGrid#_configColumn
is no longer passed acolumnId
argument, as it is already available viacolumn.id
(via the first argument)Selector
:disabled
column definition property removed; useSelection#allowSelect
insteadSelector
:dgrid-select-all
class has been removed, as nothing depended on it and it was not applied consistently (#842)Tree
:allowDuplicates
property removed, as support for this was superficial at best and more complete support would require adding undesirable complexity to core APIs likeList#row
. Instead, ensure your store items possess unique IDs, or ensureget
andgetIdentity
can handle items accordingly.dgrid/util/mouse
removed; use event delegation withdojo/mouse
events in Dojo 1.8+ instead- The
dgrid-cell-padding
CSS class has been removed as it was only meaningful for IE6 and IE7; usedgrid-cell
instead
New APIs and Features
_StoreMixin
now supports ashouldTrackCollection
property which indicates whether the grid should react to changes to trackable stores; the default istrue
Editor
now supportsautoSelect
column definition property for text field or TextBox-based widgets, to select the text in the field when an editor is activatedTree
now adds adgrid-row-expanded
class to rows that have been expanded to show their childrenPagination#refresh
: AddedkeepCurrentPage
option to refresh without resetting to the first page
Bower Support
dgrid 0.4 now contains a bower.json
, so it can automatically install its dependencies when installed via bower. Further information is available in the README.
Tests Upgraded to Intern 2
The tests in dgrid 0.4 have been updated to work with Intern 2 and Leadfoot, and are now expected to be run with Intern installed under the dgrid directory rather than outside it. The testing directions in the README have been updated accordingly.