title: extjs 4 : get store record values
body: <p>my json data looks like this : </p>
  
  <pre><code>({"success": "true", "message" : "OK","data":[{"id_metric":"1","name_filter":"doc filter","type_guicomp":"combobox"},{"id_metric":"1","name_filter":"severity","type_guicomp":"combobox"}]})
  </code></pre>
  
  <p>I'd like to be able to retrieve the <code>"type_guicomp"</code> field value for the <code>"id_metric" = 1</code> , so the result would be : <code>"type_guicomp":"combobox"</code> and <code>"type_guicomp":"combobox"</code>.</p>
  
  <p>I do this because I need the value <code>"combobox"</code> to assign it to a variable.
  I've tried several things including :</p>
  
  <pre><code>myStore.load({
          scope: this,
          callback : function(record, operation, success) {
              console.log(record);
              console.log(record.data);
              }
  </code></pre>
  
  <p>And : </p>
  
  <pre><code>var index = Ext.StoreMgr.lookup("myStore").findExact('id_metric',1);
  var rec = Ext.StoreMgr.lookup("myStore").getAt(index);
  console.log(rec);
  </code></pre>
  
  <p>These solutions return undefined or null.
  So when I did this in the callback : </p>
  
  <pre><code>var i = myStore.getCount();
  console.log(i);
  </code></pre>
  
  <p>It returned <code>0</code>. But when I check the json output, it's not empty and there's actually data in it.</p>
  
  <p>What am I doing wrong? Please any help would be appreciated.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>My store looks like this : </p>
  
  <pre><code>Ext.define('Metrics.store.MyStore', {
  extend: 'Ext.data.Store',
  model: 'Metrics.model.MyModel',
  autoLoad: true,
  idProperty: 'id_metric',
  proxy : {
      type : 'ajax',
      actionMethods : 'POST',
      node : 'id_metric',
      api : {
      read : 'gui_comp_items.php' //the php script that gets data from db
      },
      reader: {
          type: 'json',
          successProperty: 'success',
          messageProperty: 'message',
          root: 'data'
      }
  }
  });
  </code></pre>
  
  <p>My Model : </p>
  
  <pre><code>Ext.define('Metrics.model.MyModel', {
  extend: 'Ext.data.Model',
  fields: [
  {name : 'id_metric', type : 'int'},
  {name : 'name_filter', type : 'string'},
  {name : 'type_guicomp', type : 'string'},
  {name : 'value', type : 'string'}]  
  });
  </code></pre>