Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TreeGrid: setting data root has no effect

I'm trying to setup a TreeGrid, my data object looks like this:

{
    "code": "success",
    "data": {
        "text": ".",
        "children": [
            {
                "clientname": "Market",
                "contact": "OpenX Market Advertiser",
                "email": "[email protected]",

I need to tell Ext that it should use data as the root element:

var store = Ext.create('Ext.data.TreeStore', {
    model: 'Task',
    proxy: {
        type: 'ajax',
        url: 'http://localhost/rocketads/trunk/advertisers/index/stats:true/',
        reader:{
            type:'json',
            root:'data'
        }
    },
});

This doesn't work for me although I'm successfully using this with normal Stores.

like image 495
Julian Hollmann Avatar asked Aug 25 '26 05:08

Julian Hollmann


1 Answers

Since you have setup your reader with root: 'data' you have to replace 'children' with 'data' in your json:

{
    "code": "success",
    "data": {
        "text": ".",
        "data": [ // << not "children"
            {
like image 66
Molecular Man Avatar answered Aug 29 '26 00:08

Molecular Man



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!