Opened 14 years ago
Closed 14 years ago
#4238 closed defect (fixed)
dijit.Tree violates the dojo.data API.
Reported by: | Jared Jurkiewicz | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | Dijit | Version: | 0.9 |
Keywords: | Cc: | Dustin Machi | |
Blocked By: | Blocking: |
Description
The dijit.Tree widget is violating the dojo.data API and is failing with some stores because of it. This can easily be seen in the demo example:
dojox/data/demos/demo_MultiStores.html
dijit._tree.Controller, on line 28:
if the store supports Notification, subscribe to the notifcation events if (this.store._featuresdojo.data.api.Notification?){
dojo.connect(this.store, "onNew", this, "onNew"); dojo.connect(this.store, "onDelete", this, "onDelete"); dojo.connect(this.store, "onSet", this, "onSet");
}
The widget is accessing internal properties. _features is not an exposed property of the dojo.data API and access in this manner is invalid (and does break). The propery way to access the featureset a store implements is via the getFeatures() function, as defined in: dojo.data.api.Read, and in documentation:
Attachments (1)
Change History (6)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Well, it at least breaks the MultiStore? widgets one, where I demonstrated using different data stores with Tree and ComboBox? and how that they 'just worked'.
Changed 14 years ago by
Attachment: | dijit._tree.Controller_20070820.patch added |
---|
Patch for _tree/Controller.js for problem with getFeatures API
comment:3 Changed 14 years ago by
Cc: | Dustin Machi added |
---|---|
Owner: | set to bill |
comment:4 Changed 14 years ago by
comment:5 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The remaining issue is with getIdentity(), but it's not a bug per se. Tree just requires a store that implements getIdentity(). Might be able to avoid that requirement for read only trees but at this point I don't see a reason to complicate the tree code in that way.
The more proper manner to be looking up features is:
And there are other problems still. It assumes that all stores implement the Identity API, which is not true.
The code which does the binding should be checking to see if that feature is supported as well.
Basically, because of the dojo.data API violations, the only store Tree is going to work with is ItemFileReadStore?. None of the dojox.data stores work anymore and this breaks almost all the demos in dojox/data/demos as well that showed using datastores with widgets. :-(