PDA

View Full Version : Change root for JSON store



navvn
31 Mar 2011, 2:15 AM
Basicly what i want to achiev
I have json that look like:

info {
array
}
comments {
array
}
success: true

First i want to use DataView that use data stored in info

var tempTicket = new Ext.data.JsonStore({
url: '/tickets/card/id/'+sel.get('ticket_id'),
root: 'info',
fields: [
'ticket_id',
'subject',
'created_date',
'assignedto_usr_name',
'status',
'content'
]
});
tempTicket.load();

That how JsonStore looks like.

But i would like to use data stored in comments and display them as a grid.
If i add second store with diferent root i have 2 requests to server.
Is there anyway to define rot folder after data is loaded? Something like:


var tempTicket = new Ext.data.JsonStore({
url: '/tickets/card/id/'+sel.get('ticket_id')
});
tempTicket.load();




new Ext.DataView({
store: tempTicket({root: info}),
tpl: ticket_preview_tpl,
emptyText: 'No records'
})

fay
31 Mar 2011, 4:52 AM
Have you looked at this post (http://www.sencha.com/forum/showthread.php?68354-Dynamically-changing-JsonStore-root)?