I am having an issue getting the selected rows (GetSelectedRows()) on a DevEx grid when a filter is applied. It seems as though GetSelectedRows is returning the position in the grid with the filter, not the actual rowhandle in the datasource.
var rowHandles = gridView.GetSelectedRows();
var count = rowHandles.Length;
for (int indx = count-1; indx >= 0; indx-- )
{
if (rowHandles[indx] >= 0)
{
if (ServiceProxy.Instance.IsAlive(CommandNames.Delete))
((IList<ISymbolFieldInfo>)_staticPriceConfigurationBindingListUser).RemoveAt(rowHandles[indx]);
}
}
}
Can anyone tell me what I am doing wrong here. I would expect GetSelectedRows() to return the acutal row handles from the grid, not that of with a filter applied.
Thanks
I believe your assumption is incorrect. DevX documentation says, “Since row handles reflect the order in which rows are displayed within a view, modifying a single row may affect the handles of the following rows if data is sorted and/or filtered.”
I don’t think your method of removing rows within that loop is going to be safe, as each time you do, rowhandles may change. An overview on selections in the grid control can be found here