Posted 4 July 2022, 1:05 am EST
Hi,
I’ve a FlexGrid with normal rows and footer rows.
I need to have a checkcell in some footer rows.
Is it possible to do so ?
Thanks.
Forums Home / ComponentOne / WinForms Edition
Posted by: fsegui on 4 July 2022, 1:05 am EST
Posted 4 July 2022, 1:05 am EST
Hi,
I’ve a FlexGrid with normal rows and footer rows.
I need to have a checkcell in some footer rows.
Is it possible to do so ?
Thanks.
Posted 4 July 2022, 11:12 pm EST
Hi,
You can use the SetCellCheck method of FlexGrid to set the checkbox in a cell of the footer row and then you can handle the MouseClick event of the FlexGrid to toggle the state of the checkbox.
Since the footer row gets readded on sort, you will need to handle the GridChanged event and then reconfigure the checkboxes after sorting. Please refer to the sample attached and modify it according to your requirements.
Regards
Avnish
FG_FooterCheckbox.zip
Posted 5 July 2022, 7:31 pm EST
Hi,
Thanks for the sample.
One issue : if a cell is edited, checkbox disappear. What subtype of GridChanged event is better to handle it?
Posted 5 July 2022, 7:51 pm EST
I’m encountering other issues: data in footers are not persistent.
Is there a way to make “fake” footers rows? I mean normal rows but placed at the bottom of the grid
I’ve seen the sample BottomFreeze that could suits my needs but rows are frozen after the last row, not at the end of the grid.
Posted 5 July 2022, 7:59 pm EST
Hi Florent,
In this case, You can check if the Type property in the GridChangedEventArgs is GridChangedTypeEnum.CellChanged and then reconfigure the checkboxes to avoid this issue.
We would also like to suggest using the AfterSort event for sorting since the GridChanged event can occur multiple times when a column is sorted. We have used the same approach in the previous sample we sent.
If you face any issues, let us know.
Regards
Avnish
Posted 5 July 2022, 8:16 pm EST
If I only filter on GridChangedTypeEnum.CellChanged, it does not refresh the checkboxes.
Posted 5 July 2022, 8:17 pm EST
See sample attached
FG_FooterCheckbox.zip
Posted 6 July 2022, 3:07 pm EST
Hi Florent,
Sorry for the inconvenience, we were able to see the issue with the sample you provided.
We did further exploration and in some operations, the footers rows are created again which fires the GridChanged event with the GridChangedType.RowAdded. So you can just handle the GridChanged event and check if the type was GridChangedType.RowAdded and the row added was one of the footer rows. If yes, then you can reconfigure the checkboxes. This should handle any case of the checkbox.
Please refer to the sample attached. If you face any issues, let us know.
Regards
Avnish
Posted 8 July 2022, 7:51 am EST
Hi Avnish,
THanks for your feedback. I’ll do like that.