﻿function ForceDisplay(a, b) {
    return b.name + " (" + b.nb + ")";
}


/* DEBUT PEUPLE */
var RecordPeuple = Ext.data.Record.create([
		   { name: 'name' },
		   {name: 'displayName', convert: ForceDisplay },
		   { name: 'id'}
		]);

var storePeuples = new Ext.data.Store({
    storeId: 'storePeuples'
    // Data Proxy to retrieve remote data
    , proxy: new Ext.data.HttpProxy({
        url: 'api.ashx?cmd=GetMenuPeuples',
        waitMsg: 'Chargement'
    })
    // The XML Reader
    , reader: new Ext.data.JsonReader({
        record: 'Peuple',
        id: "id"
    },
	    RecordPeuple
    )
});
/* FIN PEUPLE */

/* DEBUT LOCALISATIONS */
var RecordLoc = Ext.data.Record.create([
		   { name: 'name' },
		   { name: 'displayName', convert: ForceDisplay },
		   { name: 'id' }
		]);

var storeLocs = new Ext.data.Store({
    storeId: 'storeLocs'
    // Data Proxy to retrieve remote data
    , proxy: new Ext.data.HttpProxy({
        url: 'api.ashx?cmd=GetMenuLocs',
        waitMsg: 'Chargement'
    })

    // The XML Reader
    , reader: new Ext.data.JsonReader({
        record: 'Loc',
        id: "id"
    },
		RecordLoc
    )
});
/* FIN LOCALISATIONS */

/* DEBUT INSTRUMENTS */
var RecordInstru = Ext.data.Record.create([
		   { name: 'name' },     // "mapping" property not needed if it's the same as "name"
		   {name: 'displayName', convert: ForceDisplay },
		   { name: 'id'}                 // This field will use "occupation" as the mapping.
		]);


var storeInstr = new Ext.data.Store({
    storeId: 'storeInstr'
    // Data Proxy to retrieve remote data
    , proxy: new Ext.data.HttpProxy({
        url: 'api.ashx?cmd=GetMenuInstruments',
        waitMsg: 'Chargement'
    })

    // The XML Reader
    , reader: new Ext.data.JsonReader({
        record: 'Instr',
        id: "id"
    },
		RecordInstru
    )
});
/* FIN INSTRUMENTS */

/* DEBUT INSTITUTIONS */
var RecordInstitution = Ext.data.Record.create([
		   { name: 'name' },     // "mapping" property not needed if it's the same as "name"
		   {name: 'displayName', convert: ForceDisplay },
		   { name: 'id'}                 // This field will use "occupation" as the mapping.
		]);

var storeInstitutions = new Ext.data.Store({
    storeId: 'storeInstitutions'
    // Data Proxy to retrieve remote data
    , proxy: new Ext.data.HttpProxy({
        url: 'api.ashx?cmd=getmenuinstitutions',
        waitMsg: 'Chargement'
    })

    // The XML Reader
    , reader: new Ext.data.JsonReader({
        record: 'Institution',
        id: "id"
    },
	    RecordInstitution
    )
});
/* FIN INSTITUTIONS */

