الجمعة، 20 ديسمبر 2013

Laoding JSON data into Ext.data.Tree store on click on a button

I have created a tree panel in ExtJs 4.1 and that panel is associated with store. I have some JSON data available in a variable. How can I load that into into tree store on click of a button.

Ext.define('User', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'int'}, {name: 'name', type: 'string'}, {name: 'phone', type: 'string', mapping: 'phoneNumber'} ]});var data = { users: [ { id: 1, name: 'Ed Spencer', phoneNumber: '555 1234' }, { id: 2, name: 'Abe Elias', phoneNumber: '666 1234' } ]};

//note how we set the 'root' in the reader to match the data structure above

var store = Ext.create('Ext.data.TreeStore', { autoLoad: false, model: 'User', proxy: { type: 'memory', }});

How can I load data on click of a button?


View the original article here

ليست هناك تعليقات:

إرسال تعليق