-
5 Dec 2012 11:56 PM #1
Unanswered: How to add panel as list item
Unanswered: How to add panel as list item
I am trying to dynamically add list(with its items) to my container. Instead of simple HTML template, I need list items to contain panel with a title bar, image & few more things.To do this I am loading store data and within its callback creating List & array of items. Then I add items to the list and list to the container but end result is just last panel visible instead of sliding list of all panels.Here is my code:
Is this right way to add items or I am missing something.Code:var vLists = []; this.load({ callback: function(records, operation, success) { var hccontainer = Ext.getCmp('hccontainer'); this.each(function(record){ var sid = 'styleStore'+record.get('id'); var styleTemplate = eval('tpls.styleTemplate_' + record.get('id')); vLists.push({ xtype: 'panel', scrollable: 'false', layout: 'fit', cid : record.get('id'), ctype : record.get('type'), cname : record.get('name'), stid : sid, tp : styleTemplate, items: [ { xtype : 'titlebar', title : record.get('name'), docked : 'top', cls : 'x-toolbar-transparent-top' }, { xtype : 'image', src : record.get('image'), } ] }); }); //hccontainer.remove(Ext.getCmp('hc'), true); Ext.getCmp('hc').destroy(); var hc1 = Ext.create('Ext.dataview.List', { layout : 'fit', config: { direction: 'horizontal', id : 'hc' } }); hc1.setItems(vLists); Ext.getCmp('hccontainer').add(hc1); }, scope: this });
PS Instead of List if I use Carousel, this works fine
-
8 Dec 2012 5:44 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
In Sencha Touch 2.1 you can use components just like DataView using the ListItem.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
9 Dec 2012 12:26 AM #3
Can you please elaborate? DO you mean I can add dataview in a list item?
-
9 Dec 2012 7:28 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
You can use any component within a List
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
9 Dec 2012 9:56 PM #5
Then it should have worked for me because I am adding Panel as list item and I am using 2.1
-
10 Dec 2012 6:13 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
Depends how you are doing it and how you want it to look.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.



Reply With Quote