Note that there are some explanatory texts on larger screens.

plurals
  1. POGet records from json store extjs
    primarykey
    data
    text
    <p>I have a json store loaded, I need to grab one record from it. I used : <code>getAt(index)</code>, <code>find()</code>, <code>getById()</code>, but no results . This is my code :</p> <pre><code>var appSettingReader = new Ext.data.JsonReader({ root: 'results', },[ {name: 'id', type: 'int', mapping: 'id'}, {name: 'projetId', type: 'int', mapping: 'projetId'}, {name: 'resLevels', type: 'int', mapping: 'resLevels'}, {name: 'maxResToLock', type: 'int', mapping: 'maxResToLock'}, {name: 'maxTimeToLock', type: 'int', mapping: 'maxTimeToLock'}, {name: 'infosToPrint', type: 'string', mapping: 'infosToPrint'} ]) var appSettingStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'inc/getSettings.php', method: 'POST' }), baseParams:{task: "app"}, reader : appSettingReader, sortInfo:{field: 'id', direction: "DESC"} }) appSettingStore.load(); </code></pre> <p>This code return undefined :</p> <pre><code>console.log(appSettingStore.getAt(0)); console.log(appSettingStore.find("id","1")); </code></pre> <p>This is the json string returned from server : </p> <pre><code>{success:true,"results":[{"id":"1","projetId":"1","resLevels":"1","maxResToLock":"40","maxTimeToLock":"10","infosToPrint":"1_2_3_5","hotlineMail":"admin@app.com"}]} </code></pre> <p>I've also tested this code :</p> <pre><code>var records = new Array() var test = appSettingStore.each(function(rec){ records.push(rec) }) console.log(records) </code></pre> <p>and I get an empty array ! </p> <p>PS : This store is not bound to any component; I just want to read and write to it. </p>
    singulars
    1. This table or related slice is empty.
    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.
 

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