1

I am stuck with this problem for a while and not able to find a solution anywhere

Ext.define('RmitPorject.store.Alerts', {
    extend: 'Ext.data.Store',

   /* gCameraID: function(){
        var d = this.data,
            id =d.CameraID
        return id.join(" ");
    },*/
    config: {
        model: 'RmitPorject.model.Alert',
        //sorters: 'CameraID',

        autoLoad: true,
        proxy: {
            type: 'ajax',
           // url: 'txt.json',

            url: 'Camera/'+'100001'+'.json',

            /*here, we have to make a dynamic loading url
            *  for example, we need to make a function handler
            *  It will handle the particular cameraid to request different folder camerid (url)
            * *
            * */
            //url:'http://52.64.86.42/RmitPorject/txt.json',
            reader: {
                type: 'json',
                rootProperty: 'data'
            }
        }

    }
});

this is a store file

what i want is when the user touches one of the item from the list it will use this store file to load that particular list item's JSON file. but i don't know how to transfer that list item's value to this store file so that it knows what JSON file to use

In other words , I want to make this URL tag dynamic depending on the user's response it should load data from a different JSON files , but unfortunately i dont know how to make this store dynamic.

1 Answers1

0

on user's response you can change store's url and then load store using below code

Ext.getStore('Alerts').getProxy().setUrl('Camera/'+'100001'+'.json');// create dynamic url string and pass it in setUrl method
Ext.getStore('Alerts').load();

remove "autoLoad:true" because it trys to load store instantly , might it will give you error.

Naresh Tank
  • 1,569
  • 10
  • 23