function scrollIntoView(index){
var row = this.getTemplate("row", index);
var data = this.getTemplate("layout").getContent("data");
var left = this.getTemplate("layout").getContent("left");
var scrollbars = this.getTemplate("layout").getContent("scrollbars");
try {
var top, padding = parseInt(data.element().currentStyle.paddingTop);
if (data.element().scrollTop > row.element().offsetTop - padding ) {
top = row.element().offsetTop - padding ;
left.element().scrollTop = top;
data.element().scrollTop = top;
scrollbars.element().scrollTop = top;
}
if (data.element().offsetHeight + data.element().scrollTop <
row.element().offsetTop + row.element().offsetHeight ) {
top = row.element().offsetTop ; [b]/* + row.element().offsetHeight - data.element().offsetHeight */ [/b]
left.element().scrollTop = top;
data.element().scrollTop = top;
scrollbars.element().scrollTop = top;
}
}
catch(error){
// ignore errors
}
}
var myIndex = 10; /* just for example...*/
grid.timeout(function(){
scrollIntoView.call(grid, myIndex);
[b]grid.setSelectionIndex(myIndex);[/b] /* just to "select" the row.*/
});
This topic is archived.