3.2.0

Version 2.0 Custom Drop-down Editable Textarea ....

By mixing a simplistic version of the drop-down-controls:
/javascript.forum.11951.1/grid-in-a-grid-scrollbar.html
and the editable textarea:
/javascript.forum.15056.5/why-does-text-disappear-from.html
We can obtain a cell edited by a textarea.
( maybe it's not the right and/or better way) , but could give a start-point to some enhancements.
HTH
<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>
Carlos
August 5,
All i can say is, wow
AcidRaZor
August 7,

This topic is archived.

See also:


Back to support forum