3.2.0

Serious Problem or Serious Misunderstanding

Suppose we have a grid called obj with one column with the following data:

| 23.12 |
| 14.35 |
| 17.20 |
| 0.00 |

On first loading the grid if do obj.getCellText(0,0) then we get 23.12.
After sorting the column obj.getCellText(0,0) still returns 23.12.

So if we do obj.getCellText(0,getRowIndices()[0]) then we get the value for the top row 0.00. But if we do obj.getCellText(getRowIndex()[0]) the first time, we get the wrong value.

Simply put: Before sorting we must call getCellText(0,0) to get the correct value. After sorting we must call getCellText(0,getRowIndices()[0]) to get the correct value.

Is there a way to re-order the indices after sorting so that
getCellText(0,0) always return whatever appears in the top row (or whatever row we are looking for?
Eric Juvet
May 10,
The grid uses dataSource indices, which always stay the same regardless sort order.

http://www.activewidgets.com/aw.ui.grid/row-indices.html
http://www.activewidgets.com/aw.ui.grid/row-position.html
Alex (ActiveWidgets)
May 13,
Alex:

Suppose that the grid has been sorted.

I select the upper left cell (0,0).

getCurrentRow() returns "103" or some other number.

What do I use instead of getCurrentRow() so that I can get and set the cell that is visibly at (0,0)?

Eric Juvet
May 13,
Hi Eric ,
I can't follow your logic:
>>Suppose that the grid has been sorted. I select the upper left cell (0,0).

If the grid is sorted ,then, normally the upper left cell is NO LONGER cell(0,0) ,
But instead is cell(x,y) that occupes POSITION (0,0).
Hope this sample helps,
Thanks


<script> 
var obj = new AW.UI.Grid; 
obj.setCellText(function(i,j){return j + '-' + i}); 
obj.setHeaderText(function(i){return 'header-'+ + i}); 
obj.setColumnCount(4); 
obj.setRowCount(5); 
obj.onCellMouseOver = function(event,col,row){ 
if(this.getSortColumn()>-1){ alert('On initial Load (unsorted) this row was (and still is) row # ' + row + ' and it\'s position now is # '+ this.getRowPosition(row)) }
else{ alert('This is row # ' + row + ' and it\'s position unsorted is the same')} 
 } 
document.write(obj); 
</script>
Carlos
May 13,

This topic is archived.

See also:


Back to support forum