Opened 12 years ago

Closed 8 years ago

#9576 closed enhancement (wontfix)

Enhance JsonRestStore to support arbitrary fields in referenced child items

Reported by: John Locke Owned by: John Locke
Priority: high Milestone: future
Component: DojoX Data Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:


Full discussion here: - this is an enhancement request to support saving arbitrary attributes for referenced child items in JsonRestStore?.

The main use case is for lazy-loaded trees. Kris Zyp is proposing to modify tree/jsonreststore to allow child items used in a tree to supply a name parameter and "children" attribute, so the tree does not need to load that item to display it.

That is an enhancement for displaying trees. I'm proposing an enhancement for saving tree structures, so that when you build a tree structure with JsonRestStore?, the server can simply serialize the children attribute and send it back out on future requests.

I propose adding an attribute to JsonRestStore? such as "childSaveAttrs": ['name','hasChildren','otherAttribute']. This attribute would tell JsonRestStore? to serialize these additional attributes into the parent item in addition to the $ref to the child item.

For example, without the enhancement, if you create newItems and drag them around using the tree dnd api, and then call the jrs save() function, jrs stores an item like this:

{id:"1", name:"Root", children:[{$ref:"2"}, {$ref:"3"}]}

... if this store supported childSaveAttrs, it could PUT this instead:

{id:"1", name:"Root", children:[{$ref:"2", name:"Child 1", children: true}, {$ref:"3", name:"Child 2", children: false}]}

Then the tree model could set the childSaveAttrs to include name and children attributes. This would make it easier to build lazy-loaded trees without having an additional server request for every leaf node.

I would like to see this set to an arbitrary set of attributes, because I extend the treeNode/treeItem with some additional display properties.

I also suggest using hasChildren instead of children for a boolean flag indicating whether or not an item has children--because it may be useful to sometimes recursively include children.

I would also like to see a callback function that could be provided/overided, that would allow for different items to include a different set of attributes in the same save() call.


Change History (12)

comment:1 Changed 12 years ago by Kris Zyp

Owner: changed from anonymous to Kris Zyp

comment:2 Changed 12 years ago by Kris Zyp

Status: newassigned

comment:3 Changed 12 years ago by bill

Component: GeneralDojoX Data

comment:4 Changed 11 years ago by bill

Milestone: tbd1.5

Marking as 1.5 to clear TBD tickets from 1.4 list.

comment:5 Changed 11 years ago by Adam Peller

Milestone: 1.51.6

comment:6 Changed 10 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:7 Changed 8 years ago by Kris Zyp

Resolution: wontfix
Status: assignedclosed

comment:8 Changed 8 years ago by Kris Zyp

Resolution: wontfix
Status: closedreopened

comment:9 Changed 8 years ago by Kris Zyp

Do you think this is something that should be applied to dojo/store/JsonRest?

comment:10 Changed 8 years ago by dylan

Owner: changed from Kris Zyp to John Locke
Status: reopenedpending

@freelock, if this is something you want to see in dojo/store, please let us know and/or get involved.

comment:11 Changed 8 years ago by John Locke

Status: pendingnew


This actually sounds very relevant for an upcoming project I'm hoping to get some time to work on in the next month. Yes, having this in dojo/store/JsonRest would be great.

When I get into that part of the puzzle, I might be able to provide a patch...

Thanks, John

comment:12 Changed 8 years ago by Colin Snover

Resolution: wontfix
Status: newclosed

dojox/data is abandoned. Some dojox/data stores have been upgraded to use the Dojo Store API and can be found at

Note: See TracTickets for help on using tickets.