Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
SHIFT + Click for selecting multiple rows in Tree Grid
posted

Hi,

I have a scenario where the user should be able to multi select rows with Shift+Click besides Ctrl+click in Tree Grid. Is this possible?

Thanks,

Manikanta Vundavalli

Parents
No Data
Reply
  • 700
    Verified Answer
    Offline posted

    Hello Manikanta,

    Thank you for your patience while I was looking into this matter for you.

    I have been looking into your question and what I could say is that the combination of pressing the shift key and mouse click initially provides multirow selection as it selects the first clicked row and then when selecting another row, it selects all in that range and can be performed simultaneously with the ctrl + mouse click combination.

    However, regarding your requirement, at this point, we do not provide changing the row selection with shift key behavior out of the box. Having this in mind, an approach I could suggest is using a HostListener for a keydown event and check whether the pressed key is either Shift or Control and afterwards use the IgxTreeGrid’s selected and rowSelectionChanging events in order to apply custom logic for selecting multiple rows both through shift key + mouse click and ctrl key + mouse click events.

    Additionally, in order to demonstrate my suggestion, I have prepared a small sample trying to reproduce the described behavior. On my side, everything works as expected and I am able to perform multi row selection both with the combination of shift key + mouse click and ctrl key + mouse click. Furthermore, to ensure that the marked rows are indeed the ones being selected and saved in the IgxTreeGrid’s selectedRows property, I am using a button (i.e., “SHOW SELECTED”) and when clicking it, I can see in the console all selected rows.

    Here could be found my sample for your reference. Please test it on your side and let me know if you need any further assistance.

    If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce it.

    Looking forward to hearing from you.

    Sincerely,
    Riva Ivanova
    Entry Level Software Developer

Children
No Data