Opened 9 years ago

Closed 8 years ago

#11806 closed defect (wontfix)

newItem method doesn't always return created item in dijit.tree.TreeStoreModel

Reported by: Seldarly Owned by:
Priority: high Milestone: tbd
Component: Dijit Version: 1.5
Keywords: Dijit tree TreeStoreModel Cc:
Blocked By: Blocking:


The error was detected when TreeGrid? was grouped by column dynamically. Creating new items were returning nulls.

Change History (3)

comment:1 Changed 9 years ago by bill

newItem() doesn't return anything, that's the expected behavior, not an error. Are you asking to change that?

The thing is that people may have created their own models and they won't be returning anything from newItem().

comment:2 Changed 9 years ago by Seldarly

ForestStoreModel? inherits TreeStoreModel? and newItem method in ForestStoreModel? has return value. In case of calling return this.inherite(arguments) it returns nothing cuase of TreeStoreModel?.newItem returns nothing.

comment:3 Changed 8 years ago by bill

Resolution: wontfix
Status: newclosed

I see.

TreeStoreModel can't return a value, because it executes asynchronously, asking the store if there's already an item with the same id (and then waiting for an asynchronous response). It seems like ForestStoreModel should be doing the same thing.

The alternative approach is to not do that check for if an item already exists. But for backwards-compatibility reasons, that change would have to wait until 2.0, and TreeStoreModel and ForestStoreModel won't be ported to 2.0, because they will be replaced by an interface to, see #13781.

So, for #13781 I'll consider removing that "item already exists" check and always creating a new item, and returning whatever store.put() returns, which for is the id of the item.

For the existing TreeStoreModel and ForestStoreModel, I'm afraid (as I said above) that it's not possible to change them in 1.x, and they'll be removed for 2.0. Therefore marking this as wontfix.

Note: See TracTickets for help on using tickets.