Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6127 closed defect (invalid)

dijit.tree.TreeStoreModel.getChildren does not load children

Reported by: guest Owned by:
Priority: high Milestone: 1.1
Component: Dijit Version: 1.1b1
Keywords: Cc:
Blocked By: Blocking:

Description

The current code for loading the children from the store is

for (var i=0; i<this.childrenAttr.length; i++){

var vals = store.getValues(parentItem, this.childrenAttr[i]); childItems = childItems.concat(vals);

}

as this.childrenAttr is a string, the length will return the length of the string, and this.childrenAttr[i] will get the i-th character.

I think the implementation should be changed into

var vals = store.getValues(parentItem, this.childrenAttr); childItems = childItems.concat(vals);

or even

childItems = store.getValues(parentItem, this.childrenAttr);

I'm not sure about the presence of the concat function.

hth

bartlebooth

Change History (5)

comment:1 Changed 11 years ago by bill

Resolution: invalid
Status: newclosed

No, it's an array, see the declaration:

	// childrenAttr: String
	//		one ore more attributes that holds children of a tree node
	childrenAttr: ["children"],

comment:2 Changed 11 years ago by bill

PS: but I will change the variable name to be childrenAttrs so it's less confusing. Plus fix the comment to say String{].

comment:3 Changed 11 years ago by bill

(In [12981]) Refs #6126, #6127: fix comment for childrenAttr to note that it's an array, plus change name to childrenAttrs to be less confusing. !strict

comment:4 Changed 11 years ago by bill

(In [12982]) Refs #6126, #6127: change name to childrenAttrs to be less confusing (except for Tree widget itself, for back compat) !strict

comment:5 Changed 11 years ago by bill

(In [12984]) Refs #6126, #6127: Fix bug in testcase; childrenAttrs is an array so needs to be passed in as such.

Note: See TracTickets for help on using tickets.