PDA

View Full Version : TreeLoader JSON schema, rendering, sorting



mscifo
2 Jan 2007, 8:57 AM
Jack

Will TreeLoader support custom JSON schemas and renderers like the JSONDataModel? I don't have the ability to hard code the text/id/leaf/cls attributes in my tree data response.

Also, I know that I can sort a tree by adding a TreeSorter (new Tree.TreeSorter(tree, {folderSort:true})), but how would I go about changing the tree's sort type over and over, along with the order (desc/asc).

mscifo
2 Jan 2007, 10:05 AM
Custom sorting functions would be great also, since sometimes I apply markup to my nodes (like bold/italic) and that messes with the alpha sort.

jack.slocum
3 Jan 2007, 6:58 AM
A custom sort function is passed to the TreeSorter config as sortType. e.g.

var sorter = new Ext.tree.TreeSorter(tree, {sortType: yourFunction});

As for the "schema" support, it's possibility but I don't think it will be in this release. The createNode() function on the TreeLoader was designed to be overidden and you could add your own json transformation in there.