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

查看:15
本文介绍了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 它应该使用 data 作为根元素:

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 的任何内容也用作每个后续级别的根,因此它可能是找到根节点,然后找不到它的data 属性.要么将顶级属性从数据更改为子项,要么将子项的每个实例更改为数据.

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天全站免登陆