How to remove rows of Flexgrid in MVVM mode

Posted by: malishin on 14 January 2021, 7:57 pm EST

    • Post Options:
    • Link

    Posted 14 January 2021, 7:57 pm EST

    I use the following code to remove row, but when I save the datasource I binding, this row still be there

    grid.Rows.Remove(grid.Rows[grid.Selection.TopRow]);
    
  • Posted 14 January 2021, 11:22 pm EST

    Hi Malishin,

    Rows’s Remove method only removes the row from the FlexGrid’s rows collection. Therefore, in order to delete a row from the data source you have to delete it from the FlexGrid’s CollectionView as follows:

    
    int rowIndex = flexGrid.Selection.TopRow;
    var dataItem = flexGrid.Rows[rowIndex].DataItem;
    (flexGrid.CollectionView as ListCollectionView).Remove(dataItem);
    

    Best Regards,

    Kartik

  • Posted 4 February 2021, 5:43 pm EST

    Thanks ,it works

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels