PDA

View Full Version : How to fetch/save/retrieve data from Jsonreader and output to an array/variable?



wavedan
16 Aug 2010, 5:32 AM
I have a Ext.data.Store where I have loaded data using Jsonreader. I want to fetch one or several of the values in the array, and I have tried several solutions without any luck.

An example of what I am trying to do:


Code:

alert(store.columns.dataIndex['butikk_navn']);

alert(store.data.fields['butikk_navn']);

Here's my Json code:

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'registercompany.php?mode=listRegistercompany',

method : 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'response.value.items',

totalProperty: 'total_count',
id: 'company_id'
},[
{name: 'company_id'},
{name: 'company_name'},
{name: 'orgno'},
{name: 'firstname'},
{name: 'lastname'},
{name: 'address1'},
{name: 'address2'},
{name: 'postalcode'},
{name: 'postalarea'},
{name: 'phone1'},
{name: 'mobile'},
{name: 'fax1'},
{name: 'email'},
{name: 'www'},
{name: 'bankaccount'},
{name: 'password'},
{name: 'member_role'},
{name: 'activation_code'},
{name: 'activation_status'},
{name: 'bransje'},
{name: 'apningstider_hverdag'},
{name: 'apningstider_helg'},
{name: 'stengetider_helg'},
{name: 'stengetider_hverdag'},
{name: 'butikk_navn'},
{name: 'butikk_addresse'},
{name: 'butikk_telefon'},
{name: 'butikk_postnummer'},
{name: 'butikk_poststed'},
{name: 'butikk_beskrivelse'},
{name: 'butikk_faks'},
{name: 'butikk_epost'}

])
});

Where I am trying to output the field name butikk_navn.