Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show nested items in Sencha Touch list
    primarykey
    data
    text
    <p>I have following json data.</p> <pre><code>{ "pendingTasksVOs" : [{ "groupName" : "LAST_MONTH", "documents" : [{ "description" : "kvk1", "uploadDate" : "1-12-2012" } ] }, { "groupName" : "OLDER", "documents" : [{ "description" : "kvk2", "uploadDate" : "1-11-2012" }, { "description" : "kvk3", "uploadDate" : "1-10-2012" }, { "description" : "kvk4", "uploadDate" : "1-01-2012" } ] } ] } </code></pre> <p>I want to show it in Sencha Touch list grouped by GroupName .</p> <p>I want list to be in following format:</p> <pre> GoupName : Group1 ----------------------------- Description11 , UploadDate11 This should be separate clickable list row ----------------------------- Description12 , UploadDate12 This should be separate clickable list row ----------------------------- Description13 , UploadDate13 This should be separate clickable list row ----------------------------- ****************************** GoupName : Group2 ----------------------------- Description21 , UploadDate21 This should be separate clickable list row ----------------------------- Description22 , UploadDate22 This should be separate clickable list row ----------------------------- ****************************** </pre> <p>I am trying to use Sencha Touch List component. But I am not to get the list as per above requirements</p> <pre><code>//This is my store var store = Ext.create('Ext.data.Store', { model: 'Demo.model.DocumentList', rootProperty: 'pendingTasksVOs', autoLoad: true, grouper: { groupFn: function(record) { if (record &amp;&amp; record.data.title) { return record.get('groupName'); } else { return ''; } } } }); //template for list item var listTemplate = new Ext.XTemplate( '&lt;tpl for="."&gt;', '{groupName}&lt;/br&gt;', '&lt;ul&gt;', '&lt;tpl for="documents"&gt;', '{description} {uploadDate} &lt;/br&gt;', '&lt;/tpl&gt;', '&lt;/ul&gt;', '&lt;/tpl&gt;' ); // Initialize the main view Ext.getCmp("pendingTasksListId").add(Ext.create('Ext.List', { fullscreen: true, itemTpl: listTemplate, store: store, groupField:'description', grouped: true })); //DocumentListModel is defined under /app/model/ Ext.define('Demo.model.DocumentList', { extend: 'Ext.data.Model', requires : ['Demo.model.Doc'], config: { fields: ['groupName', 'documents'], hasMany : { model : "Demo.model.Doc", associationKey: 'documents' }, proxy: { type: 'rest', url : "/getPendingTasks", reader: { type: 'json', rootProperty : 'pendingTasksVOs' } } } } //Document Model is defined under /app/model/ Ext.define('Demo.model.Doc', { extend: 'Ext.data.Model', config: { fields: ['description', 'uploadDate'], belongsTo: "Demo.model.DocumentList" } }); }); </code></pre> <p>I am able to get the list item as follows:</p> <pre> GroupName, Description11,UploadDate11 Description12,UploadDate12 </pre> <p>But above whole content is clickable. I want to have each Description &amp; UploadDate pair to be clickable.</p> <p>Can anyone guide me on how can I achieve above stated requirement? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload