пример установки прокрутки в желаемое место:
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 + row.element().offsetHeight - data.element().offsetHeight; left.element().scrollTop = top; data.element().scrollTop = top; scrollbars.element().scrollTop = top; } } catch(error){ // ignore errors } }
obj.timeout(function(){ scrollIntoView.call(obj, 15); });
|