Opened 13 years ago
Closed 13 years ago
#8491 closed defect (wontfix)
Tree: unexpected error message when empty items provided
Reported by: | Les | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.2.3 |
Keywords: | Tree | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
The following code fragment results in an error message:
dijit.tree.TreeStoreModel: query null returned 0 items, but must return exactly one item
var data = {identifier: 'id', items: [ ]}; var store = new dojo.data.ItemFileReadStore({data: data}); var model = new dijit.tree.TreeStoreModel({store: store}); new dijit.Tree({model: model});
I'd prefer if no error message (or a better one) was displayed when tree data has no items.
Change History (3)
comment:1 follow-up: 2 Changed 13 years ago by
Description: | modified (diff) |
---|
comment:2 follow-up: 3 Changed 13 years ago by
Using TreeStoreModel? I should be able to create a tree with no nodes when no data is provided (sometimes I get an empty array of items from the server). However, the current Tree code requires that there's exactly one data item to construct the root.
The error message (if it has to be displayed) is too technical. It creates support issues. It should simply state that the tree could not be created because no data was provided.
comment:3 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Replying to Les:
Using TreeStoreModel I should be able to create a tree with no nodes when no data is provided (sometimes I get an empty array of items from the server). However, the current Tree code requires that there's exactly one data item to construct the root.
TreeStoreModel is working according to it's spec. As I said, it sounds like you want to use ForestStoreModel and are mistakenly using TreeStoreModel.
The error message (if it has to be displayed) is too technical. It creates support issues. It should simply state that the tree could not be created because no data was provided.
Users should never see this error message; it's for developers. Sorry, I like the current message as it gives the developer more information, telling them that the query was run but it returned no data.
If you prefer no error message then perhaps you should be using ForestStoreModel instead of TreeStoreModel, but anyway I guess the "null" in the error message above is confusing? It seems like you didn't provide any query at all to your TreeStoreModel? That's rather strange. Is it supposed to be a hierarchical data source with only one top level item, so that a plain store.fetch() call will get the one item?