:: Forum >>

Resizing grid while keeping selected row in view

Hello, I would like to be able to, when a row is selected, resize the grid (make it smaller) and ensure the the row that was selected is still in view. Can anybody tell me how to do these 2 things? Thanks.

Joe
Joe Hudson
Wednesday, April 26, 2006
Joe,

here is the code which adjusts scroll top to make current row visible -

var i = this.getCurrentRow();
var scroll = this.getScrollProperty("top");
var height = this.getRowProperty("height");
var top = (this.getRowPosition(i)-this.getRowOffset()) * height;

if(top < scroll) {
    this.setTimeout(function(){
        this.setScrollTop(top);
    });
}

var max = this.getContentHeight(1);
var bottom = top + height;

if (max + scroll < bottom){
    this.setTimeout(function(){
        this.setScrollTop(bottom - max);
    });
}
Alex (ActiveWidgets)
Wednesday, April 26, 2006

This topic is archived.


Back to support forum

Forum search