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

Multiselect dropdown in Treegrid

Hi, can you pls share some sample in javascript to show multiselect dropdown in tree grid?

1 Reply

MP Manivannan Padmanaban Syncfusion Team July 26, 2019 11:36 AM UTC

Hi Saravanan, 

Greetings from Syncfusion Support. 

Query: can you pls share some sample in javascript to show multiselect dropdown in tree grid? 

From the above query, we are able to understand that you want to use the multiselect dropdown in tree grid. Using edit template we can achieve your requirement. Refer the below code example, 

…………….. 
    let grid: TreeGrid = new TreeGrid( 
        { 
            dataSource: sampleData, 
            childMapping: 'subtasks', 
            treeColumnIndex: 1, 
            height: 400, 
……………………… 
            columns: [ 
                { 
                    field: 'taskID', headerText: 'Task ID', isPrimaryKey: true, textAlign: 'Right', 
                    validationRules: { required: true, number: true }, width: 80 
                }, 
                { field: 'taskName', headerText: 'Task Name',  edit:  
                    {  
                       create: function() { 
          elem = document.createElement("input"); 
          return elem; 
        }, 
        read: () => { 
          return multiSelectObj.value; 
        }, 
        destroy: () => { 
          multiSelectObj.destroy(); 
        }, 
        write: args => { 
          multiSelectObj = new MultiSelect({ 
             dataSource: <{key: string, value: any}[]>grid.grid.dataSource, 
             fields: { value: 'taskName' }, 
               value: Array.isArray(args.rowData["taskName"])? args.rowData["taskName"] : [args.rowData["taskName"]],  
          }); 
          multiSelectObj.appendTo(elem); 
        } 
    }, 
                width: 200  }, 
                { 
                    field: 'priority', headerText: 'Priority', width: 90,  
     
                } 
            ] 
        }); 
    grid.appendTo('#Grid'); 
 


Output
  


If we misunderstood your requirement, please get back to us with the below details. 

  1. Explain your requirement in detail.
  2. Confirm whether are you want to display the multiselect dropdown at the treegrid initial rendering Or while editing the records.
  3. Share the Screenshot Or video demo of your requirement.

Provided details will help us, to resolve the reported issue as early as possible. 

Regards, 
Manivannan Padmanaban. 


Loader.
Live Chat Icon For mobile
Up arrow icon