TreeGrid:设置数据根没有效果 [英] TreeGrid: setting data root has no effect

查看:107
本文介绍了TreeGrid:设置数据根没有效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个TreeGrid,我的数据对象如下所示:

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": "asdasd@asdasd222.de",

我需要告诉Ext它应该使用数据作为根元素:

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.

推荐答案

不幸的是,使用TreeStore,无论您用于root还是用作每个后续级别的根,因此可能会找到根节点,然后找不到其数据属性。将顶级属性从数据更改为子项或将每个子实例更改为数据。

Unfortunately with a TreeStore, whatever you use for root is also used as the root for each subsequent level, so it's probably finding the root node, then not finding its data property. Either change the top level property from data to children or change each instance of children to data.

这篇关于TreeGrid:设置数据根没有效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆