Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting a Custom Reader in ExtJS
    primarykey
    data
    text
    <p>I am new to ExtJS and am playing around with it, I am receiving following JSON from the server as shown below</p> <pre><code>{"tid":1,"action":"HelloWorld","method":"getData", "result": {"InstId":"1", "value": [ {"country.stateId":"101", "country.stateName":"TA"}, {"country.stateId":"102", "country.stateName":"ABC"}, {"country.stateId":"103", "country.stateName":"DEF"}]}", "type":"rpc"} </code></pre> <p>and I need to extract values form the above JSON and populate the combobox. To do this job I need to write a custom Reader to read and populate the in the combobox. Can anyone of you please help me in writing a custom reader?</p> <p>Following are the various snippet</p> <pre><code>Ext.define('AM.store.TestStore', { extend: 'Ext.data.Store', alias : 'widget.testStore', model: 'AM.model.TestModel', autoload:true, proxy: { type: 'direct', directFn: HelloWorld.getData, extraParams:[ {'InstId': '1', 'boxid':'id'}, {'InstId': '1', 'name':'states'} ], reader:{ type:'json', root:'result' } }); </code></pre> <p>Following is the view object</p> <pre><code>Ext.define('AM.view.combobox.TestView' ,{ extend: 'Ext.form.ComboBox', alias : 'widget.TestView', fieldLabel: 'States', store:'TestStore', renderTo: Ext.getBody(), displayField: 'country.stateName', valueField: 'country.stateId', autoselect:false }); </code></pre> <p>Following is my Model Object</p> <pre><code>Ext.define('AM.model.TestModel', { extend: 'Ext.data.Model', alias : 'widget.TestModel', fields: [ {name: 'country.stateId'}, {name: 'country.stateName'}] ); </code></pre> <p>Following is my controller</p> <pre><code>Ext.define('AM.controller.Funds', { extend: 'Ext.app.Controller', alias : 'widget.FundsController', views: ['combobox.TestView'], stores: ['TestStore'], models:['TestModel'] ); </code></pre> <p>Can anyone please help me to write a custom JSON Reader?</p> <p>Thanks<br/> Phani Kumar</p>
    singulars
    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