:: Forum >>

How to get the row no in grid

I have to select multiple rows to perform some operation and need the row no of the rows selected by user. Any suggestions?
Jack
Wednesday, April 5, 2006
You can get the array of the selected row indices with getSelectedRows() method (or as an argument in onSelectedRowsChanged event). The row number (position from the top in the current order) could be obtained with getRowPosition(rowIndex) method.

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

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

    obj.setSelectionMode("multi-row");

    obj.onSelectedRowsChanged = function(rowIndexArray){

        var rowIndex, rowPosition, i, s = "";

        for(i=0; i<rowIndexArray.length; i++){
            rowIndex = rowIndexArray[i];
            rowPosition = this.getRowPosition(rowIndex);
            s += " " + rowPosition;
        }

        window.status = s;
    }

    document.write(obj);
Alex (ActiveWidgets)
Wednesday, April 5, 2006
Thanks
Jack
Wednesday, April 5, 2006

This topic is archived.


Back to support forum

Forum search