<script>
var lastcol;
var lastrow;
var isanyddvisible = false;
var lastTopPos;
//*************//
function recordtextA(){
objtextarea.setContent('value', objtextarea.element().value );
obj.setCellText( this.getContent('value'), lastcol, lastrow)
}
var objtextarea = new AW.HTML.TEXTAREA;
objtextarea.setStyle("width", '300');
objtextarea.setStyle("height", "100");
objtextarea.setStyle("POSITION", "ABSOLUTE");
objtextarea.setStyle("Z-INDEX", "1000000000");
objtextarea.setStyle("background", "lightyellow");
objtextarea.setEvent('onkeyup', recordtextA );
objtextarea.setStyle("display", "none") ;
document.write(objtextarea);
//****************//
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setVirtualMode(false);
obj.setColumnCount(10);
obj.setRowCount(10);
/////// SCROLL-TOP CHANGED (ENABLE / DISABLE SCROLL )//////////////
obj.onScrollTopChanged = function(top){
if(isanyddvisible){ if (top != lastTopPos){ return "obj.setScrollTop(lastTopPos)" } }
}
obj.onScrollTopError = function(error){ eval(error); }
///******************///
obj.onCellClicked = function(event, column, row){
if( isanyddvisible ) {
/// hide drop-down object
objtextarea.setStyle("display", "none") ;
isanyddvisible = false;
obj.setScrollTop( lastTopPos );
}
}
///******************///
obj.onCellDoubleClicked = function(event, column, row){
/// retaint scroll pos
lastTopPos = obj.getScrollTop();
isanyddvisible = true;
objtextarea.setContent('value', '');
objtextarea.setContent("text", obj.getCellText( column, row) );
objtextarea.refresh();
/// postion the drop-down object below cell
var el = obj.getCellTemplate(column, row).element();
if(!AW.ie) {
objtextarea.setStyle("left", AW.getLeft(el) - obj.getScrollLeft() );
objtextarea.setStyle("top", AW.getTop(el) - obj.getScrollTop() + el.offsetHeight );
}
else{
objtextarea.setStyle("left", AW.getLeft(el) - 2 );
objtextarea.setStyle("top", AW.getTop(el) - 3 + el.offsetHeight );
}
objtextarea.setStyle("display", "block") ;
lastcol=column;
lastrow=row;
}
///******************///
document.write(obj);
</script>
This topic is archived.