Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Clearly, Ext doesn't like that you have encoded a json object as a string and then put them in another json object. You have two options that I see.</p> <ol> <li><p>See if you can return the dict on the server-side without first converting it into a string. Some code, somewhere, is taking your string and putting it in a json object with 'Results' and 'Total'. Check to see if that code can take a <code>Dictionary</code> as-is.</p></li> <li><p>Unwrap the 'Results' propery on the client-side. One way would be to make your own reader:</p></li> </ol> <pre><code>Ext.define('MyReader', { extend: 'Ext.data.reader.Json', alias: 'reader.my-json', read: function(object) { object.Results = Ext.Array.map(object.Results, Ext.decode); return this.callParent([object]); } }); </code></pre> <p>Then use <code>type: 'my-json'</code> in your reader config.</p> <p>Here is my test case:</p> <pre><code>var data = {"Results":["{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}"],"Total":4}; Ext.define('Currency', { extend: 'Ext.data.Model', fields: [ { name: 'BaseCurrency', type: 'string' }, { name: 'TermCurrency', type: 'string' } ] }); Ext.define('MyReader', { extend: 'Ext.data.reader.Json', alias: 'reader.my-json', read: function(object) { object.Results = Ext.Array.map(object.Results, Ext.decode); return this.callParent([object]); } }); var store = Ext.create('Ext.data.Store', { model: 'Currency', data: data, proxy: { type: 'memory', reader: { type: 'my-json', root: 'Results', totalProperty: 'Total' } } }); </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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