PDA

View Full Version : Best way to add a new NestedList at the leaf of another NestedList?



pwayner
8 Dec 2010, 6:07 AM
I have a big pile of data that I want to put in a NestedList. Most people will only browse a small portion of it. My thought is to break it into two tiers. When a person drills down to a leaf node in the first tier, the app will create another NestedList object with the next tier. I've tried implementing it like this:


function createDetailCardNested(record, parentRecord) {
console.log(record);
var tag=record.getRecord().raw.tag;
var d=playerData[tag];
var listMe=fix(d,tag,null);

var localStore = new Ext.data.TreeStore({
model: 'ListItem',
root: listMe,
proxy: {
type: 'memory',
reader: {
type: 'tree',
root: 'items'
}
}
});

var a= new Ext.NestedList({
fullscreen: true,
title: 'Players',
displayField: 'text',
loadingText:'Loading...',
store: localStore,
getDetailCard : createDetailCard2

});


//var b= new Ext.Panel({
// target content update here
// });

return a;
}

This sort of works. I can drill down to the bottom but I can't come back up. Suddenly the Back button stops working!

My questions are:

1) Is this a good architectural path?

2) Another solution is to somehow manipulate the underlying data store, flip the leaf parameter to false, and insert a new set of items. Is this possible? The addNode routine seems designed to add the Node at the top level. But perhaps I'm wrong.

3) A third path is to just make a big, big data structure.

Any thoughts, no matter how cursory or half-baked, would be appreciated.

Thanks.

3)