FlexGrid MultiRange Selection Mode AllowFiltering Issue

Posted by: james on 17 July 2023, 12:23 pm EST

  • Posted 17 July 2023, 12:23 pm EST - Updated 17 July 2023, 12:28 pm EST

    Summary: When using the MultiRange selection mode with AllowFiltering enabled in FlexGrid, selecting a range of visible rows also selects the hidden rows in between.

    I have an issue with the FlexGrid Selection Mode, and the use of “AllowFiltering” that enables the column filters.

    I have attached some sample code to highlight the issue.

    • If we use “ListBox” selection mode, then we do not have a problem. But with ListBox selection mode, we cannot copy the value of a single cell, as with ListBox selection mode, the whole role is highlighted.

    • We want to use “MultiRange” selection mode, because it allows us to have multiple selections, and also the ability to copy the text of a single cell.

    The problem we experience is when a filter is applied to the grid by the user, then when they select a range of rows, it also selects the hidden rows.

    You can see this problem by running the sample form I provided.

    Steps to reproduce the issue:

    1. Click the “Description” column filter button, and select to show only “0”. This will hide half the rows.
    2. Select all 4 rows.
    3. Click the “Description” column filter button, and select to show all values.
    4. You will see that the rows in-between are also selected.

    This does not happen if “ListBox” selection mode is used, which solves our problem. But ListBox introduces a new problem, that we cannot select and copy the value of a single cell.

    Fix - I’m not sure if it’s possible, but I imagine one way around it is to have multiple selections created, instead of a single selection, when a selection is made within a filtered view. Because at the moment, it’s a bit misleading that rows are being selected that are not visible. Maybe AllowFiltering should not be allowed unless ListBox selection mode is used.

    I hope what I’ve described makes sense… We would be happy with ListBox mode behaviour with the multirange selection mode, or to allow ListBox to select a single cell that we can copy. So maybe a modified version of ListBox that does not do a full row select?

    I have attached the Project, and also screen shots of the problem.

    FlexGridSelectionModeTest.zip

  • Posted 17 July 2023, 11:23 pm EST

    Hi James,

    Thanks a lot for providing all the details and the sample project. We could see both the behaviors you mentioned on our end. As per our understanding of your requirement, we have updated the sample project to provide a workaround to select only a single cell when C1FlexGrid.SelectionMode = SelectionModeEnum.ListBox

    However, to handle the Copy-Paste in the case of a single cell, you will need to temporarily disable the C1FlexGrid.AutoClipboard and handle it manually. We have also implemented it in the sample project.

    If you still face any issues, please let us know and we will try our best to assist you further.

    Attachment: FlexGridSelectionMode_CustomSelection.zip

    Best Regards,

    Kartik

  • Posted 20 July 2023, 2:35 pm EST

    thanks, I’ll have a look at the sample and let you know how I go.

  • Posted 26 July 2023, 12:54 pm EST

    Thank you for the sample, but it’s not exactly what we are after. I gave it a play, and there were a couple of things that stuck out, such as selecting a single row, and then using ctrl to add another row - it just behaved not as I would expect.

    I do like your sample with the way the clipboard is handled, and I think as a middle ground, we will handle Ctrl-S to copy a single cell, and Ctrl-C to copy the selection. This appears to work quite well - and should cover our needs.

    Ideally, we would want MultiRange selection to handle filtered grids properly, by creating multiple ranges if it crosses a gap. MultiRange has the desired behaviour we want, except for the issue when making a selection on a filtered grid.

    I don’t know if the MultiRange mode could be extended to handle a filtered grid the way a user would expect - but that would be great if it could.

    Also, not sure if it’s possible to click the top left of the grid to select all. The rectangle that is to the left of the column headers, and above the row headers. this works on a datagridview, but it appears not to work for the flexgrid as far as I can tell… apologies if it is documented somewhere.

  • Posted 26 July 2023, 12:54 pm EST

    Thank you for the sample, but it’s not exactly what we are after. I gave it a play, and there were a couple of things that stuck out, such as selecting a single row, and then using ctrl to add another row - it just behaved not as I would expect.

    I do like your sample with the way the clipboard is handled, and I think as a middle ground, we will handle Ctrl-S to copy a single cell, and Ctrl-C to copy the selection. This appears to work quite well - and should cover our needs.

    Ideally, we would want MultiRange selection to handle filtered grids properly, by creating multiple ranges if it crosses a gap. MultiRange has the desired behaviour we want, except for the issue when making a selection on a filtered grid.

    I don’t know if the MultiRange mode could be extended to handle a filtered grid the way a user would expect - but that would be great if it could.

    Also, not sure if it’s possible to click the top left of the grid to select all. The rectangle that is to the left of the column headers, and above the row headers. this works on a datagridview, but it appears not to work for the flexgrid as far as I can tell… apologies if it is documented somewhere.

  • Posted 26 July 2023, 7:35 pm EST

    Hi,

    We completely understand your concerns and apologize for the inconvenience caused to you. We have shared your requirement with the development team to get their insights on it and will let you know the updates as soon as possible.

    [Internal Tracking ID: C1WIN-30799]

    FYI, clicking the cell [0, 0] selects all the cells only when the SelectionMode = Default. For other SelectionModes, you can manually implement this using the MouseDown event of the C1FlexGrid.

    private void C1FlexGrid1_MouseDown(object sender, MouseEventArgs e)
    {
            var ht = c1FlexGrid1.HitTest(e.X, e.Y);
            if (ht.Row == 0 && ht.Column == 0)
            {
                    c1FlexGrid1.Select(c1FlexGrid1.Rows.Fixed, c1FlexGrid1.Cols.Fixed, c1FlexGrid1.Rows.Count - 1, c1FlexGrid1.Cols.Count - 1);
            }
    }

    Best Regards,

    Kartik

  • Posted 30 July 2023, 12:37 pm EST

    Great. Thanks for that. It would be amazing if MultiRange behaved properly when selecting in filtered mode.

    I appreciate the support.

  • Posted 12 October 2023, 7:22 pm EST - Updated 12 October 2023, 7:27 pm EST

    Hi… Unfortunately the bug is worse than I thought.

    It also effects “ListBox” Selection mode.

    I have attached an image, and also an updated sample project.

    For ListBox selection, if you have a look at my picture below it shows the order of events which I’ll describe here.

    1. Filter out row 4.
    2. Select rows 3 through to 5 by using the Row Headers. Click Row 3 header, hold down shift, click row 5 header.
    3. Undo the filter.
    4. You can see that row 4 is selected too. (this is also verifiable in code, with the filter still applied, by checking the selection.

    Please note that ListBox behaves properly in some scenarios, as long as you don’t use the Row Headers to select. If you instead click on the values in the “ID” column to do the selection, then row 4 won’t incorrectly get selected.

    Please note that this incorrect behaviour happens also for the FlexGrid when in MultiRange selection mode, but for MultiRange selection mode the issue happens regardless of where you make the selection from. (row headers and values)

    I hope this makes sense.

    Are we able to get these bugs fixed for both ListBox selection mode and MultiRange selection mode? It also happens in RowRange mode, but I would imagine that would be harder to fix because it’s a single range and the row is still there, but maybe some sort of feature that does not allow selection if filtering is enabled or something.

    I’d imagine ListBox selection mode would be the easiest to fix, as it already behaves properly in some scenarios, just not the row header scenario. but it would be great to get MultiRange working too, as it’s better for copy and paste.

    Thanks

    FlexGridSelectionModeTest (2).zip

  • Posted 1 November 2023, 6:16 pm EST

    Hi James,

    We are very sorry for the delay in response. We are getting in touch with the development team to get an update on your requirements and will let you know as soon as possible.

    Regarding the row selection behavior of the ListBox SelectionMode that you shared, thanks a lot for providing the screenshots and sample project. We could observe the behavior on our end. We have escalated it to the development team to get their views on it and will let you know the updates soon.

    [Internal Tracking ID: C1WIN-31304]

    Best Regards,

    Kartik

  • Posted 6 November 2023, 12:10 pm EST

    Thanks Kartik. Hopefully they are able to fix.

  • Posted 4 December 2023, 11:00 pm EST

    Hi James,

    After all the research and discussion over your requirements, the development team has decided to enhance the behavior of the MultiRange selection mode, to ignore the selection of rows hidden due to filtering.

    Regarding the row selection issue with the ListBox SelectionMode, it is a bug and will be fixed in the upcoming releases.

    We will let you know all the further updates soon.

    Best Regards,

    Kartik

  • Posted 5 December 2023, 6:51 pm EST

    Hi Kartik

    That is great to hear. These changes would be great.

    I was able to work around my issues by using “Default” selection mode, and ignoring hidden rows that were part of the selection.

    Thanks

    James

  • Posted 29 January 2024, 11:10 pm EST

    Hi James,

    The row selection issue with the ListBox SelectionMode (https://developer.mescius.com/forums/winforms-edition/flexgrid-multirange-selection-mode-allowfiltering-issue#71334) has been fixed in the latest 2023v3(636) hotfix release. You can either update to the latest version using ComponentOneControlPanel or directly install the latest packages from NuGet.

    Regarding the enhancement of the behavior of the MultiRange selection mode, we will let you know as soon as it is implemented.

    Best Regards,

    Kartik

  • Posted 1 February 2024, 7:22 pm EST

    Hi Kartik

    Thanks for the update. I appreciate it.

    Kind Regards

    James

Need extra support?

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

Learn More

Forum Channels