PDA

View Full Version : [4.1] How I'll create a model from json file?



darkhorni
13 Jun 2012, 6:07 AM
This the model that I want to create using json file


Ext.define('Users', {
extend: 'Ext.data.Model',
fields: [{name: 'user_id', type: 'int'},
{name: 'user_name', type: 'string'}]
});

What I have to make in order to create it from a json file before the grid is being created?

el_chief
13 Jun 2012, 11:29 AM
Generally, you would load a JSON packet via an HTTP response.

IE, you make a request to the server (or locally even), it return JSON, and the Model's Reader parses it and loads the model.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.reader.Json