-
3 Oct 2012 2:01 AM #1
Unanswered: list within a list in itemtpl
Unanswered: list within a list in itemtpl
Hi all,
I have a list of employees. Each employee can be associated with more than 1 departments.
I am able to show the list of employees using itemTpl. How do I show the department list?
I tried adding tpl for loop:
<tpl for="departments">{departments.deptName}</tpl> However that doesn't work.
My list is a list of
ThanksCode:{ xtype: 'list', id: 'myList', itemId:"myListId", itemTpl: "<div ><table>" + "<tr><td>Employee Name </td><td>{empName}</td><td>Designation </td><td>{designation}</td></tr>" + "<tr><td><tpl for="departments">{departments.deptName}</tpl> </td></tr>" + "</table></div>", flex: 1, store:{ id: 'myStore', model:'myModel', data: '' }, width: '100%' }
-
9 Oct 2012 5:34 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
The <tpl for="departments"> part is telling the XTemplate that it can loop through an array of objects. So therefore you only need to do {deptName} as you are now with in an object within that array.Code:<tpl for="departments">{departments.deptName}</tpl>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