Hi Folks,
I'm cloning the kiva LoanList example and I'm able to load the list from using an Ajax proxy. The rub is that if I want to reload with a new URL, the only way I can figure out to do it is with a new data data store, ie this.store = new Ext.data.store() etc. Unless I'm missing something, I'm not seeing the load() or reload(). I see older references to reload(params{}) but I can't get them to work. Any pointers? Snippet below:
Code:
filterResults: function (filterBar, values) {
//alert("DJH reload offer list here");
function doReefresh(request, success) {
if (success) {
this.refresh();
} else {
alert("Search request failed");
}
}
this.store = new Ext.data.Store({
model: 'Offer',
sorters: [{
field: 'title'
}],
proxy: {
type: 'ajax',
//url: getSearchURL(),
url: 'http://localhost/php/sencha/examples/digisearch/list1.json',
//url: 'http://dev.jugger.com/digipowers/phone/digisearch/list.json',
//url: '/list.json',
reader: {
type: 'json',
root: 'offers'
},
// DJH question, why is this.refresh() not in scope?
//afterRequest: doRefresh(request, success)
afterRequest: function (request, success) {
if (success) {
// this.refresh() is not in scope?
//this.refresh();
} else {
alert("Search request failed");
}
}
},
autoLoad: true,
listeners: {
scope: this,
datachanged: function () {
alert('4');
//DJH this refresh is accessible this.refresh();
}
}
});
// DJH, this is worthwhile, but being called to early.
this.refresh();
// //
// // DJH this doesn't work
// //
// // http://tdg-i.com/325/ext-js-screencast-data-stores-and-gridpanels
// this.store.proxy.api.read.url = 'http://localhost/php/sencha/examples//list1.json'
// this.store.reload();
// // DJH Neither does this
// this.store.reload({
// model: 'Offer',
// sorters: [{
// field: 'title'
// }],
// proxy: {
// type: 'ajax',
// url: 'http://localhost/php/sencha/examples/list1.json',
// reader: {
// type: 'json',
// root: 'offers'
// }
// },
// listeners: {
// scope: this,
// datachanged: function () {
// alert('4');
// }
// }
// }
// );
}