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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Multiselect dropdown in Treegrid

Thread ID:

Created:

Updated:

Platform:

Replies:

146207 Jul 25,2019 03:34 PM UTC Jul 26,2019 11:36 AM UTC JavaScript - EJ 2 1
loading
Tags: TreeGrid
Saravanan
Asked On July 25, 2019 03:34 PM UTC

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

Manivannan Padmanaban [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon