PDA

View Full Version : treegrid with local data?



buergi
4 May 2010, 5:45 AM
Hi

I take the code from the treegrid-example, remove dataUrl, add loader and root with some data.

Now I get a "attributes is undefined" error.

What am I doing wrong?



xtype: 'treegrid',
title: 'Core Team Projects',
width: 500,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
loader: new Ext.tree.TreeLoader({
preloadChildren: true
}),
root: [{
task:'Project: Shopping',
duration:13.25,
user:'Tommy Maintz',
iconCls:'task-folder',
expanded: true
}],
columns:[{
header: 'Task',
dataIndex: 'task',
width: 230
},{
header: 'Duration',
width: 100,
dataIndex: 'duration',
align: 'center',
sortType: 'asFloat',
tpl: new Ext.XTemplate('{duration:this.formatHours}', {
formatHours: function(v) {
if(v < 1) {
return Math.round(v * 60) + ' mins';
} else if (Math.floor(v) !== v) {
var min = v - Math.floor(v);
return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm';
} else {
return v + ' hour' + (v === 1 ? '' : 's');
}
}
})
},{
header: 'Assigned To',
width: 150,
dataIndex: 'user'
}]

wm003
4 May 2010, 6:13 AM
i guess it's because treegrid is basically a grid, not a tree. So the common treeloader won't work here

buergi
4 May 2010, 6:18 AM
Ok, the solution was simple:



root: new Ext.tree.AsyncTreeNode({
text: 'Lists',
draggable: false,
children: json,
id: 'root'
})

wm003
4 May 2010, 11:37 AM
ah, i mixed up the new treegrid (which is build from columntree) and the "old" treegrid ux from maximgb (which was basically a grid), so i was totally wrong before.

anya
13 May 2010, 10:39 PM
To: buergi (http://www.extjs.com/forum/member.php?20242-buergi)

http://www.extjs.com/forum/images/site_icons/profile.png View Profile (http://www.extjs.com/forum/member.php?20242-buergi)
http://www.extjs.com/forum/images/site_icons/forum.png View Forum Posts (http://www.extjs.com/forum/search.php?do=finduser&userid=20242&contenttype=vBForum_Post&showposts=1)
http://www.extjs.com/forum/images/site_icons/message.png Private Message (http://www.extjs.com/forum/private.php?do=newpm&u=20242)
http://www.extjs.com/forum/images/site_icons/add.png Add as Contact (http://www.extjs.com/forum/profile.php?do=addlist&userlist=buddy&u=20242)


No, still wrong

ypwong
3 Jun 2010, 1:14 PM
did you manage to get the treegrid with local store working?? I am also in need of it. Would it be possible to post the solutions??

buergi
3 Jun 2010, 9:27 PM
I already did 2 posts above :-)