danvega
21 Jul 2010, 2:44 PM
So I have a list and there are 4 buttons at the top of the screen Wed,Thurs,Fri,Sat. When you click one loadData method is called (below) which basically updates the list store with new data.
I found a small bug with my application and I am not quite sure how to fix it. Say on Wed you scroll half way down a long list and then click Fri. The list is still in the same position, in other words it did not go back to the beginning. I understand why as well, we are updating the data not the UI Component. Is there a way to refresh the view and have it start at the 1st data item?
I tried the method refresh() on the list but that did not work
loadData: function(b,e){
Ext.getBody().mask(false, '<div class="loading">Loading…</div>');
var dURL = 'data/' + b.id + '.txt';
Ext.Ajax.request({
url: dURL,//replace with AJAX call
success: function(response, opts) {
Ext.getBody().unmask();
result = JSON.parse(response.responseText);
var item = result;
if (item) {
Ext.getCmp('sessionList').getStore().loadData(item);
}
else {
//alert('There was an error retrieving the list.');
}
},
failure: function(response, opts){
Ext.getBody().unmask();
}
});
}
I found a small bug with my application and I am not quite sure how to fix it. Say on Wed you scroll half way down a long list and then click Fri. The list is still in the same position, in other words it did not go back to the beginning. I understand why as well, we are updating the data not the UI Component. Is there a way to refresh the view and have it start at the 1st data item?
I tried the method refresh() on the list but that did not work
loadData: function(b,e){
Ext.getBody().mask(false, '<div class="loading">Loading…</div>');
var dURL = 'data/' + b.id + '.txt';
Ext.Ajax.request({
url: dURL,//replace with AJAX call
success: function(response, opts) {
Ext.getBody().unmask();
result = JSON.parse(response.responseText);
var item = result;
if (item) {
Ext.getCmp('sessionList').getStore().loadData(item);
}
else {
//alert('There was an error retrieving the list.');
}
},
failure: function(response, opts){
Ext.getBody().unmask();
}
});
}