:: Forum >>

[no subject]

The old Reflex database had a handy feature... in the grid if you hit the double quote ( " ) it would copy the contents from the cell above into the current cell.
This code reproduces that behavior. Press " and it will copy the data from the cell above.

Code:

obj.onCellValidating = function(text, column, row){
if (text=='"') {
var prevRow = -1;
var rowIndicesArray = obj.getRowIndices();
if (rowIndicesArray){ // we are sorted, so find our place
for (var i=1;i<rowIndicesArray.length && prevRow<0;i++){
if (rowIndicesArray[i] == row){ prevRow = rowIndicesArray[i-1] }
}
} else {prevRow=row-1}
if (prevRow>=0){
obj.setCellText(obj.getCellText(column,prevRow),column,row);
} else { return 1 }
}
}



Why is this better than copy and paste? It's not better per se, but it is faster in many circumstances... to paste you have to place the cell into edit mode. With this method you can hit " <down> " <down> " <down> to fill in a column of values.
I just started with Active Widgets, so improvements are welcome. I could not find an easy way of finding what actual row index I was on, so I looped RowIndices to find it.
PeteR
Monday, July 2, 2007
Drat - hit Post without typing a subject. Sorry 'bout that, Chief. Doesn't look like there is any way to fix it.
PeteR
Monday, July 2, 2007

This topic is archived.


Back to support forum

Forum search