PDA

View Full Version : Loading data in Tree Store



Sandeesh
23 Mar 2012, 12:32 AM
Hi,
I have implemented a Tree Grid in the following manner :-
1) Defined the model

Ext.define('QLI', { extend: 'Ext.data.Model',
fields: [
{name: 'ProductId', type: 'string'},
{name: 'ProductName', type:'string'},
{name: 'ProductCode', type:'string'},
{name: 'ListPrice', type: 'float'},
{name: 'SalesPrice', type: 'float'},
{name: 'discountPercent', type: 'string'},
{name: 'Description', type:'string'},
{name: 'Quantity', type: 'float'},
{name: 'ExtendedDescription__c', type:'string'},
{name: 'productType', type:'string' },
{name: 'flatDiscount', type:'string' }

],

});

2)
Defined the store as :-

var qliStore = Ext.create('Ext.data.TreeStore', {
model: 'QLI',
proxy: {
type: 'ajax',
url:'{!$Page.QLIGridJsonPage}'
}
});

I wanted to know, whether there is an alternative way of providing the Json data to tree store
I dont intend to use the following :-

proxy: {
type: 'ajax',
url:'{!$Page.QLIGridJsonPage}' // i want to avoid this
}

Is there any other option ?

mitchellsimoens
23 Mar 2012, 10:59 AM
You can specify the root and children to have local data.