:: Forum >>

Cell editing with Single Row selection


I tried to perform an example in which i have to edit some cells but a single row selection must be performed !
the method i have used:
-initiating the grid to a single-row selection
-at a double click the single cell selection is activated to perform editing
-at the cell editing validation i return to the single row selection

it works sometimes but other times multiple rows still selected !!

have you other ideas please !
Thanks :)
Helmus
Friday, August 10, 2007
The trick is to set current column and current row before starting the edit because normally in row selection mode the current column is not set -

obj.onCellDoubleClicked = function(event, col, row){
    this.setCurrentColumn(col);
    this.setCurrentRow(row);
    this.raiseEvent("editCurrentCell", event, col, row);
};


Here is the full code -

var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");

obj.setColumnCount(10);
obj.setRowCount(10);

obj.setCellEditable(true);
obj.setSelectionMode("single-row");

obj.onCellDoubleClicked = function(event, col, row){
    this.setCurrentColumn(col);
    this.setCurrentRow(row);
    this.raiseEvent("editCurrentCell", event, col, row);
};

document.write(obj);
Alex (ActiveWidgets)
Friday, August 10, 2007
thanks a lot !
it is working !
;)
Helmus
Tuesday, August 14, 2007

This topic is archived.


Back to support forum

Forum search