View Full Version : Basic list component

24 Aug 2011, 11:07 PM
Hey all,
I just want to add a simple list. An HTML equavilent would be like this:

<li>New York</li>
<li>San Francisco</li>

Even for this simple list, do I have to define a store and a model?
Or is it possible to just pass an items array to the list?

25 Aug 2011, 10:56 AM
You can simply add HTML to Panel but it won't have much functionality unless included in the HTML itself.

If you want to use an array of items, they would have to be created as a JSON object and then added to a store. Ext.Lists require a store and itemTpl config. So even a list that simple being used in Ext.List will require a store (with a model) to be created.

If you do not want it to look like an Ext.List, you can use a Ext.DataView, which is basically the parent of a List, but you must include a store, tpl, and itemSelector. In your case, the itemSelector would be set up like this: itemSelector: 'li', (this is only if you want functionality to be implemented with listeners on the DataView)

So, if you just want to list a few items for users to view, and nothing else, just use straight html in a Panel's 'html' config. Otherwise, use a List or DataView.