There's probably some way to get the tree controller to use an existing
root item, but I don't know how.

I think the easiest solution would be to simply add the missing "name"
property to the JSON data before the tree is created. You can use the
JSON store's delegate to do so:

http://demo.qooxdoo.org/current/apiviewer/#qx.data.store.IStoreDelegate~manipulateData

If you need any special logic to create the tree root item, the
controller also has a delegate property that allows you to fully
customize how items are created.

On 08.01.2015 17:48, Asken wrote:
> In the tree demo at
> http://demo.qooxdoo.org/current/demobrowser/#data~JsonToTree.html the data
> looks like:
> 
> {
>     "name": "root",
>     "kids": [
>         {
>             "name": "1",
>             "kids": [
>                 {
>                     "name": "1.1" 
>                 },
>                 {
>                     "name": "1.2" 
>                 },
>                 {
>                     "name": "1.3" 
>                 } 
>             ] 
>         }
>     ]
> }
> 
> I have already added the root to my tree and my data returned from the
> server looks like below:
> {
>     "children": [
>         {
>             "id": 1,
>             "name": "data"
>         },
>         {
>             "id": 4,
>             "name": "m2"
>         },
>         {
>             "id": 7,
>             "name": "qooxdoo"
>         }
>     ],
>     "success": true
> }
> 
> I only want to add the children to the tree but for obvious reasons it fails
> as there is no "name" property on the first level.
> 
> Can this be done using the store and store.bind or do I have to use xhr
> instead?
> 
> Regards,
> Kristian
> 
> 
> 
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/Custom-tree-data-binding-tp7586620.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to