Opened 8 years ago
Closed 8 years ago
#16362 closed defect (fixed)
dijit/tree/ObjectStoreModel.fetchItemByIdentity() Fails with dojo/store/MemoryStore
Reported by: | Fergus Hadley | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.9 |
Component: | Dijit | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The following line in the fetchItemByIdentity() method of dijit/tree/ObjectStoreModel fails when using a MemoryStore? to power the tree:
this.store.get(keywordArgs.identity).then(
because MemoryStores? return a Javascript object not a deferred. It looks like this function is designed to work with the old dojo.data stores...
Error message: "TypeError?: this.store.get(keywordArgs.identity).then is not a function".
The method could also do with some comments about usage. Nothing shows up in the API.
Change History (4)
comment:1 Changed 8 years ago by
Component: | General → Dijit |
---|---|
Milestone: | tbd → 1.9 |
Owner: | set to bill |
Status: | new → assigned |
comment:2 follow-up: 3 Changed 8 years ago by
Thanks for looking at this. I realise, on reflection, that this method is specifically for old-style stores. I was calling it directly and should have been using get(id) instead.
Still, I agree dojo/when would be better and perhaps some documentation... :)
comment:3 Changed 8 years ago by
Replying to voidstate:
Thanks for looking at this. I realise, on reflection, that this method is specifically for old-style stores.
The issue is that fetchItemByIdentity() isn't used at all, and should be removed. It's got nothing in particular to do with old or new stores.
Still, I agree dojo/when would be better and perhaps some documentation... :)
Well, fetchItemByIdentity() and all the other methods are documented fully in model.js:
fetchItemByIdentity: function(keywordArgs){ // summary: // Given the identity of an item, this method returns the item that has // that identity through the onItem callback. Conforming implementations // should return null if there is no item with the given identity. // Implementations of fetchItemByIdentity() may sometimes return an item // from a local cache and may sometimes fetch an item from a remote server. // tags: // extension },
The issue is that ObjectStoreModel doesn't actual extend dojo/tree/model, since it doesn't need to. So, I need to add some doc-comments so the doc parser thinks ObjectStoreModel extends dojo/tree/model.
Hmm, it should be a when() (dojo/when) rather than a then(), but the fact that Tree is still working with MemoryStore says that fetchItemByIdentity() isn't used at all. Or were you seeing some actual error with Tree? If so, please attach a test case, since our tests aren't catching it.