Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got the solution for my question.</p> <p>Create following custom json reader under /app/reader/ folder as CustomReader.js</p> <pre><code>Ext.define('Demo.reader.CustomReader', { extend: 'Ext.data.reader.Json', alias: 'reader.customReader', getData: function(data) { // overriding data = this.callParent(arguments); var responseString = Ext.encode(data); var json = JSON.parse(responseString); var result = []; Ext.each(json.pendingTasksVOs, function(entry) { var groupName = entry.groupName; Ext.each(entry.documents || [], function(document) { result.push({ description : document.description, uploadDate: document.uploadDate, groupName: groupName }); }); }); return result; } }); </code></pre> <p>Doc model should be created at /app/model as follows as Doc.js</p> <pre><code>Ext.define('Demo.model.Doc', { extend: 'Ext.data.Model', config: { fields: ['description','uploadDate','groupName'] } }); </code></pre> <p>Store can be created at /app/store folder Store should use this custom reader as follows:</p> <pre><code>Ext.define("Demo.store.DocumentStore", { extend:'Ext.data.Store', requires:['Demo.model.Doc' , 'Ext.data.proxy.Rest', 'Demo.reader.CustomReader'], id:'DocumentStore1', config:{ model:'Demo.model.Doc', autoLoad:true, grouper:{ groupFn:function (record) { if (record &amp;&amp; record.data.groupName) { return record.get('groupName'); } else { return ''; } } }, proxy:{ type:'rest', url:"/getPendingTasks", reader:{ type:'customReader' //This is our custom reader } } } }); </code></pre> <p>//Finally You can create the list as follows </p> <pre><code>Ext.create('Demo.store.DocumentStore'); // Initialize the main view Ext.getCmp("pendingTasksListId").add(Ext.create('Ext.List', { fullscreen:true, itemTpl:'&lt;div class="contact"&gt;{description} {uploadDate} {groupName} &lt;/div&gt;', store: 'DocumentStore1', grouped:true })); </code></pre> <p>Above gives me the list where I get separate row for each {description} {uploadDate} pair from the received json specified in question</p>
    singulars
    1. This table or related slice is empty.
    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