EJ2 Data Grid Multiselect in a cell

Hi.

I have an array of users, and I want to display them in a multi-select component in a grid cell but I can't find out how.

Thanks everyone for helping.


1 Reply

HJ Hariharan J V Syncfusion Team June 17, 2019 12:42 PM UTC

Hi Didier, 

Thanks for contacting Syncfusion support. 

We have validated your query and suspect that you want to display the multi-select dropdown in the Grid. You can achieve your requirement using `editTemplate` feature of the Grid. We have prepared a sample for your reference. Please refer the below code example, Documentation and sample for your reference. 

load: function () { 
    this.columns[2].edit = { 
        create: function () { 
            elem = document.createElement('input'); 
            return elem; 
        }, 
        read: function () { 
            return multiSelectObj.value; 
        }, 
        write: function (args) { 
            multiSelectObj = new ej.dropdowns.MultiSelect({ 
                dataSource: jsonCities, 
                fields: { 
                    value: "Id", 
                    text: "Label" 
                }, 
                mode: 'CheckBox', 
                showSelectAll: true, 
                value: Array.isArray(args.rowData["ShipCity"])? args.rowData["ShipCity"] : [args.rowData["ShipCity"]], 
                enabled: (!this.parent.columns[2].allowEditing)? false : true, 
                placeholder: 'Select holder' 
            }); 
            multiSelectObj.appendTo(elem); 
        } 
    }; 
}, 
}); 



If this is not your exact query, Please get back to us for further assistance. 

Regards, 
Hariharan 


Loader.
Up arrow icon