Hello,
is it possible to have multi row selection in ultragrid for winforms with checkboxes.
I think it is not buildin functionality. But can it done by not to complex development? Creating a custom CheckBoxMultiRowSelectionHandler.
Do you have some ideas?
regards
Andreas
Again, there is no built-in way to do this. You could do it using a CreationFilter. But I think it would be more complicated to do that than to use an unbound column. In fact, you would probably need an unbound column, anyway, because you need a place to store the check state.
Agreed with Andreas, RowSelector with checkbox is ok with us.
Is posible to embed checkbox to the selector???
Hi Andreas,
You are correct that there is no functionality like this built-in to the grid.
I'm not sure how generic you could make this. You'd have to add a CheckBox column to the grid at some point, and give it a name or probably position it.And you may needs to have some way to initialize the checked rows - depending on your requirement.
The simplest implementation would be to simply use the InitializeLayout event to add an unbound column to the grid and set it's DataType to boolean. Then when you want to find the checked rows, you loop through all of the rows in the grid and look for rows whose checkbox column value is true.
A more efficient way to do it would be to keep track of the Checked rows in a List or a HashSet. This is a little tricky depending on your requirements. You might have to loop through the existing rows initially to populate the list. After that, you would probably handle the CellChange event and watch for the checking or unchecking of the checkbox to add or remove items from the list, respectively.
If you want the checked rows to appear selected, then this could easily be handled in the InitializeRow event of the grid.
I forgot something ...
the solution should not only work on one form with some code.
It should be a generic enhancement of the grid that could be used in each grid of an application.