My treegrid looks like this:
but there is also an empty folder in the beginning. I don't want this to be there. So what is wrong with my 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
}
]
}
or with my store:
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'
}
]
});
There is another bug in there. When i close 'Cameraman' my firefox crash with this error: too much recursion and/or it will show all the leafs again:
I made it in architect so maybe there is a problem too. What is it what i am doing wrong?
Cheers
This is really two questions, to answer the question the title asks, the first node isnt really an empty folder (at least not in the picture you provide) its actually the top level root, to hide it simply set:
rootVisible : false
I'd have to look into the recursion issue further before offering an explanation- you may want to split that out into another question, as given the current title you may not attract those able to answer it for you.