Forum Discussion

Amna_Saeed321's avatar
Amna_Saeed321
Occasional Contributor
4 years ago
Solved

How to get the Cell Object which I Clicked using function ClickCell in grid view

I am facing an issue that I cannot access all rows in the Grid view because the row index property "WPFControlOrdinalNo" is returning random numbers if grid is having rows more than 5 rows with verti...
  • anupamchampati's avatar
    4 years ago

    Below function will Return i which will give you the cell no and will click on the cell as well with the below parameters:
    Grid - Grid Object
    Column - Column name to be clicked
    Value - Which value to be clicked in Column

    function ClickGrid(Grid,Column,Value)
    {
    var RowIndex;
    function FindRow(Grid, Column, Value, ViewId)
    {
    if (typeof(ViewId) == "undefined")
    ViewId = 0;
    for (var i=0; i<Grid.wRowCount(ViewId); i++)
    if (Grid.wValue(i, Column, ViewId) == Value)
    return i;
    return -1;
    }
    RowIndex = FindRow(Grid,Column,Value);
    if (RowIndex != -1)
    {
    Grid.ClickCell(RowIndex, Column);
    Log.Message("Row index: " + RowIndex + " Column Name: " + Value);
    }
    else
    Log.Error("Row was not found");
    }