We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting multi selection(row) in treegrid by code

I didn't find a solution to set the multi selection for rows in the treegrid by code.
I have added a little sample with my problem.
If i click the button some selections should be set in the treegrid (e.g. index 0,2,4).

Some samples shows the the selection can be shown by "....addClass("e-selectionbackground e-active")", but if i add some additional selections (Ctrl+Click), in the rowSelected event the args.model.selectedItems would not return the selections that are only set with "....addClass("e-selectionbackground e-active")".

Is there any possibility to make a multi row select in the treegrid by code where the selectedItems(or an other property) holds the correct selected items?


Attachment: EssentialStudioforJavaScript_TreeGridMultiSelect_ed9951db.zip

1 Reply

JA Jesus Arockia Sankaran S Syncfusion Team June 13, 2019 02:04 PM UTC

Hi Michael, 
Greetings from Syncfusion support. 
In TreeGrid, we can select multiple rows by using selectRows method and by enabling multiSelectCtrlRequest property. And we can get the selected records details by using getSelectedRecords method. 
Please find the code example below. 
<button onclick=selectRow() > Select Rows</button > 
function selectRow() { 
            var obj = $("#TreeGridContainer").data("ejTreeGrid"); 
            var index = [0, 2, 4]; 
            for (var i = 0; i < index.length; i++) { 
                obj._multiSelectCtrlRequest = true; 
Please find the below sample link. 
Please get back to us if you require further assistance on this. 
Jesus Arockia Sankaran S 

Live Chat Icon For mobile
Up arrow icon