hi all,
have a little question.
I have a tabpanel with a dataview in it.
PHP Code:
var chatstore = new Ext.data.JsonStore({
url: 'database.php',
baseParams:{task: "GETCHATS",
lines: '9'
},
root: 'images',
fields: ['chats']
});
chatstore.load();
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div id="yummie">{chats}</div>',
'</tpl>',
'<div class="x-clear"></div>'
)
var view = new Ext.DataView({
height:380,
id:'viewchat',
name:'viewchat',
emptyText: '<div class="info">Error !!!!!!</div>',
itemSelector:'div.yummie',
store: chatstore,
tpl: tpl,
});
var tabs = new Ext.TabPanel({
id:'tabs',
region : 'center',
activeTab : 0,
border:true,
height: 380,
autoScroll:true,
bodyStyle:'padding:5px;padding-top:3px;padding-bottom:20px;',
items : [view]
});
how can i let the dataview scroll automatically to the buttom?
i'm using animal's code:
PHP Code:
Ext.override(Ext.Element, {
scrollTo : function(side, value, animate){
var side = side.toLowerCase();
var prop;
switch (side) {
case "left":
prop = "scrollLeft";
break;
case "right":
prop = "scrollLeft";
value = this.dom.scrollWidth - (value + this.dom.clientWidth);
break;
case "top":
prop = "scrollTop";
break;
case "bottom":
prop = "scrollTop";
value = this.dom.scrollHeight - (value + this.dom.clientHeight);
break;
}
if (value < 0) value = 0;
if(!animate || !Ext.lib.Anim){
this.dom[prop] = value;
}else{
var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
}
return this;
}
});
but when i do this:
PHP Code:
view.scrollTo("bottom", 0,true);
or this
PHP Code:
view.scroll("bottom",0)
it doesn't work.
any help is appreciated,
Regards,
robin30