我的treegrid看起来像这样:
但是开头还有一个空文件夹。我不希望它在那里。所以我的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'
}
]
});
还有另一个错误。当我关闭'摄影师'时,我的火狐会因此错误而崩溃:过多的递归和/或它会再次显示所有的叶子:
我是在建筑师那里做的,所以也许也有问题。我做错了什么?
干杯
答案 0 :(得分:1)
这真的有两个问题,为了回答标题要求的问题,第一个节点实际上并不是一个空文件夹(至少不是你提供的图片)它实际上是顶层根,要隐藏它只是设置:
rootVisible : false
在提供解释之前,我必须进一步研究递归问题 - 您可能希望将其分解为另一个问题,因为考虑到当前标题,您可能无法吸引那些能够为您解答的问题。