extjssencha-touch-2.3

In Sencha Touch, how do I notify all stores associated with a model after calling MyApp.MyModel.load()


How do I notify all stores associated with a model after calling MyApp.MyModel.load()? Alternatively, is there a way to load 1 record by Id from the context of a store?

My ultimate goal is to fetch one single record from the server and refresh a list that is bound to a store that has the record in it.


Solution

  • Don't do a Myapp.model.load. Use store.load instead.

    Because what you really want to do is this:

    function refreshSingleItem(store,id) {
        store.remove(store.getById(id));
        store.getProxy().setExtraParam("id",id);
        store.load({addRecords:true;});
    }