:: Forum >>

Scroll Into View scrollbars not defined errors

When trying to implement the following function (or other examples like it found in the forums) get the following error

scrollbars has no properties
[Break on this error] var x = scrollbars.element().scrollLeft;

Any assistance would be appreciated
Paul
Friday, June 27, 2008
I guess it would help if I provided the function...

var _refresh = obj.refresh;
obj.refresh = function(){
var scrollbars = this.getTemplate("layout").getContent("scrollbars");
var x = scrollbars.element().scrollLeft;
var y = scrollbars.element().scrollTop;
var data = this.getTemplate("layout").getContent("data");
var data_x = data.element().scrollLeft;
var data_y = data.element().scrollTop;
var top = this.getTemplate("layout").getContent("top");
var top_x = top.element().scrollLeft;
var top_y = top.element().scrollTop;
_refresh.call(this);
this.element().runtimeStyle.visibility = "hidden";
var _obj = this;
window.setTimeout(function(){
scrollbars.element().scrollLeft = x;
scrollbars.element().scrollTop = y;
data.element().scrollLeft = data_x;
data.element().scrollTop = data_y;
top.element().scrollLeft = top_x;
top.element().scrollTop = top_y;
_obj.element().runtimeStyle.visibility = "visible";
_obj.element().focus();
}, 0 );
}

This function was copied directly from the forums
Paul
Monday, June 30, 2008
Paul, this code seems to be from version 1 and I guess you are actually using version 2. If so, you need to calculate scroll offset using the row height and row position and then call grid.setScrollTop().
Alex (ActiveWidgets)
Monday, June 30, 2008
Thanks Alex...yes, I am using ver 2 and doing cell level editing in a backend file and returning the values as an xml file. Can you point me in the direction of an example...if you know of one...using the grid.setScrollTop() upon return from an AJAX call in the obj.onCellValidated () function...here is my current rendition:

obj.onCellValidated = function(text, column, row){

var r = new AW.HTTP.Request;
r.setURL("/controller/cellManager.php");
r.setRequestMethod("POST");
r.setParameter("column", column);
r.setParameter("row", row);
r.setParameter("text", text);
r.setParameter("ajaxMode", 'cellUpdate');
r.setParameter("xmlFile", '<? echo $_REQUEST[xmlFile]; ?>');
r.request();

r.response = function(data){

if (data.indexOf('NOTICE') !=-1){
alert(data);
}

obj.clearCellModel();
obj.setCellModel(table);
obj.setCellEditable(true);

var d = new Date();
table.setURL("/xmlFiles/<? echo $_REQUEST['xmlFile']; ?>?"+d.getTime());
table.request();

}
}
Paul
Monday, June 30, 2008

This topic is archived.


Back to support forum

Forum search