PDA

View Full Version : Create nested list items from database



blessan
10 Aug 2010, 2:07 AM
Hi, Im trying to create a nested list where the items come from the browser database.



var openNestedList = new Ext.NestedList({
id:'best',
cls:'openNestedList',
items: [{
cls:'openNestedListItem',
html: 'Angela Cox'
},{
cls:'openNestedListItem',
html: 'John Doe'
}]
});


The above is my code. I want to keep my 'items' empty and then later add them based on values from the database. How can this be done. I tried to do it in the listeners but nothing seems to work.
Can some one please help?

evant
10 Aug 2010, 2:17 AM
It's reasonably easy, if you have a look at the source for the class you'll see how it sets up the lists. You basically need to do the same thing, only after it's created.

blessan
10 Aug 2010, 2:42 AM
At the end i did something like


var p = new Ext.Panel({
cls:'openNestedListItem',
html: ' Salt'
});
list.items.itemAt(0).insert(0,p);

It added the item.

A friend of mine told me to use a dataview as for HTML config i have a tpl. I took that out over here to make the code look simple.
All I get from my database is a bunch of names which I want to put in the HTML in each item.
What is the best approach to get this done?
Does sencha have any store that access data from a sqllite database?