PDA

View Full Version : [OPEN] [FIXED-212] List not reducing scroll position after reload



meyerovb
10 Aug 2010, 11:16 AM
In the code example below, scroll down in the list, then press the button. The list appears empty, but if you scroll back up you'll see the new element (and subsequently you will not be able to scroll down again). Expected behavior would be for the container to scroll so it's lower limit matches the bottom of the screen (if it still overflows). My workaround is to scroll manually after reloading the data, let me know if there's another workaround for now.



Ext.setup({ onReady: function () {
var data = [];
for (var x = 0; x < 100; x++) data[data.length] = { html: x };
new Ext.List({
fullscreen: true,
store: new Ext.data.Store({ fields: ['html'] }),
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{html}</div></tpl>'),
itemSelector: '.list-item',
dockedItems: [{ dock: 'top', xtype: 'button', text: 'shorten list',
handler: function () {
this.ownerCt.getStore().loadData([{ html: 'invisible'}]);
}
}]
}).getStore().loadData(data);
}});

Jamie Avins
11 Aug 2010, 9:39 AM
Thanks for the report.

aconran
15 Sep 2010, 5:26 PM
Fixed in 0.96.

tothzoli
31 Mar 2011, 12:11 AM
Hello,

I have same problem. It does't work in sencha 1.1

openxtiger
31 Jan 2012, 10:34 PM
Ext.override(Ext.DataView,{
refresh: function() {
if (!this.rendered) {
return;
}


this.fireEvent('beforerefresh', this);
var el = this.getTargetEl(),
records = this.store.getRange();
el.update('');
if (records.length < 1) {
if (!this.deferEmptyText || this.hasSkippedEmptyText) {
el.update(this.emptyText);
}
this.all.clear();
} else {
this.tpl.overwrite(el, this.collectData(records, 0));
this.all.fill(Ext.query(this.itemSelector, el.dom));
this.updateIndexes(0);
}
this.hasSkippedEmptyText = true;


if (this.scroller) {
this.scroller.scrollTo({x:0, y:0});
}


this.fireEvent('refresh', this);
}
});