2

我的树形网格看起来像这样: 树形网格

但开头也有一个空文件夹。我不希望它在那里。那么我的json有什么问题:

{
"children": [
    {
        "type": "Videotechnicus",
        "prijs": "35",
        "children": [
            {
                "id": 52,
                "uren": "09:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Laden",
                "leaf": true
            },
            {
                "id": 53,
                "uren": "10:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Reizen",
                "leaf": true
            },
            {
                "id": 54,
                "uren": "11:30:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Bouwen",
                "leaf": true
            },
            {
                "id": 55,
                "uren": "12:30:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Lunch",
                "leaf": true
            },
            {
                "id": 56,
                "uren": "16:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Plenair live",
                "leaf": true
            },
            {
                "id": 57,
                "uren": "17:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Afbouw",
                "leaf": true
            },
            {
                "id": 58,
                "uren": "18:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Terugreis",
                "leaf": true
            },
            {
                "id": 59,
                "uren": "19:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Uitladen",
                "leaf": true
            }
        ],
        "leaf": false
    },
    {
        "type": "Cameraman",
        "prijs": "45",
        "children": [
            {
                "id": 52,
                "uren": "09:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Laden",
                "leaf": true
            },
            {
                "id": 53,
                "uren": "10:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Reizen",
                "leaf": true
            },
            {
                "id": 54,
                "uren": "11:30:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Bouwen",
                "leaf": true
            },
            {
                "id": 55,
                "uren": "12:30:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Lunch",
                "leaf": true
            },
            {
                "id": 56,
                "uren": "16:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Plenair live",
                "leaf": true
            },
            {
                "id": 57,
                "uren": "17:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Afbouw",
                "leaf": true
            },
            {
                "id": 58,
                "uren": "18:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 1,
                "type": "Terugreis",
                "leaf": true
            },
            {
                "id": 59,
                "uren": "19:00:00",
                "aanwezig": 1,
                "bedrag": 100,
                "totaal": 100,
                "factureren": 0,
                "type": "Uitladen",
                "leaf": true
            }
        ],
        "leaf": false
    }
]
}

或与我的商店:

Ext.define('MyApp.store.opdrachtPersoneelTree', {
extend: 'Ext.data.TreeStore',
alias: 'store.opdrachtPersoneelTree',

requires: [
    'MyApp.model.personeelOfferteTree'
],

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        autoLoad: true,
        model: 'MyApp.model.personeelOfferteTree',
        storeId: 'opdrachtPersoneelTree',
        nodeParam: 'type',
        proxy: {
            type: 'ajax',
            url: 'json/opdrachtpersoneel.php',
            reader: {
                type: 'json'
            }
        }
    }, cfg)]);
}
});


Ext.define('MyApp.model.personeelOfferteTree', {
extend: 'Ext.data.Model',

fields: [
    {
        name: 'type'
    },
    {
        name: 'uren'
    },
    {
        name: 'aanwezig'
    },
    {
        name: 'bedrag'
    },
    {
        name: 'totaal'
    }
]
});

那里还有另一个错误。当我关闭“Cameraman”时,我的 Firefox 崩溃并出现此错误:递归过多和/或它将再次显示所有叶子:

在此处输入图像描述

我是在建筑师那里做的,所以也许也有问题。我做错了什么?

干杯

4

1 回答 1

1

这确实是两个问题,要回答标题提出的问题,第一个节点并不是真正的空文件夹(至少在您提供的图片中不是)它实际上是顶级根,隐藏它只需设置:

rootVisible : false

在提供解释之前,我必须进一步研究递归问题 - 您可能希望将其拆分为另一个问题,因为鉴于当前的标题,您可能无法吸引那些能够为您回答的人。

于 2013-11-12T10:33:58.727 回答