FlexGrid onSelectionChanged with CTRL key

Posted by: metrik on 25 July 2018, 12:45 am EST

    • Post Options:
    • Link

    Posted 25 July 2018, 12:45 am EST

    Hi,

    I have subscribed my FlexGrid to selectionChanged event as follows:
    
    
    flexGrid.selectionChanged.addHandler((grid: FlexGrid, e: CellRangeEventArgs) =>
            {
                const range = e.range;
            });
    
    

    it works well when user selects only one cell/row or an uninterrupted range of cells/rows. But if a user selects cells with the help of “CTRL” key I only receive notification about last selected cell, no information about other selected cells/rows is present in the event.

    For example, I can select cell (1,1). Then I’ll hold the CTRL key and select cell (5,1) - so will have two selected cells in total. In the onSelectionChanged event though I will only receive notification about cell (5,1), cell (1,1) will not be included into range.

    How can I receive all the selected cells in FlexGrid?

  • Posted 25 July 2018, 12:49 am EST

    I think I’ve figured it out already - there is a selectedItems property in FlexGrid.

  • Posted 26 July 2018, 5:25 am EST

    Hi,

    We are glad to hear that you find the solution.

    Yes, you are correct. The selectedItems property is for getting selected rows and it can be set by code while the SelectionMode is set to ListBox.

    ~Manish

Need extra support?

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

Learn More

Forum Channels