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

Need to add varying datasource for dropdown in grid column for each row

I have added a column with dropdown list multiselect in grid . I need to add different datasource for each dropdown in each column.

how can we achieve it .

5 Replies

HO Harshita Ojha November 10, 2022 11:19 AM

The grid code is :

<ejs-grid #clientGrid id="clientGrid" [dataSource]='clientData' enableStickyHeader='true'
                        allowTextWrap='true' [enableHover]="false" allowPaging='true' [pageSettings]='pageSettings'
                        [toolbar]="toolbar" [allowExcelExport]='true' allowResizing='true'
                        (actionBegin)="actionBegin($event)" locale='en-US' (dataStateChange)="dataStateChange($event)"

                            <e-column field='clientName' headerText='Client'

                            <e-column field='status' headerText='Status' width='50'>
                                <ng-template #template let-data>
                                    <label class="switch">
                                        <input type="checkbox" checked>
                                        <span class="slider round"></span>
                            <e-column field="boForClients" headerText="Beneficial owner" width="100">
                                <ng-template let-data #template>
                                    <ejs-multiselect id='boForClients' placeholder='Benificial owner' name="boForClients"
                                        [dataSource]='boForClients' [fields]='fields' (close)="onClose($event)"
                                        showDropDownIcon='true' showSelectAll=true floatLabelType="always">


VB Vinitha Balasubramanian Syncfusion Team November 11, 2022 06:02 AM

Hi Harshita Ojha,

Greetings from Syncfusion support.

Before providing a solution to your query, we need some information to know your requirement clearly which will help us proceed further at our end. Kindly share the below details.

  1. Kindly ensure that the different dataSource you want to render in the dropdown want to update the values to the Grid column.

  2. Please ensure that does have any relationship for dropdown dataSource and Grid dataSource  

  3. Also ensure that you want to render different dataSource only for the display purpose.

  4. Share the type of the data binding you are using for the dropdown you want to bound.

  5. Share the package version you are using.

  6. Share the details if you have any customization on close event of dropdown.

  7. Do you want to bound the different dataSource in multiselect dropdown for every column


Vinitha Balasubramanian

HO Harshita Ojha November 11, 2022 06:09 AM

hi Vinitha,

Thanks for your reply. I am able to bind the datasource in the grid columns. But now the issue i am facing is the data selected in the dropdown template is not able to get in the ngmodel. Could you please help how can we retrieve the selected data in the grid.

the grid code is:

<ejs-grid #clientGrid id="clientGrid" [dataSource]='clientData' enableStickyHeader='true'
                        allowTextWrap='true' [enableHover]="false" allowPaging='true' [pageSettings]='pageSettings'
                        [toolbar]="toolbar"  allowResizing='true'
                       locale='en-US'   >

                            <e-column field='clientName' headerText='Client'

                            <e-column field='isActive' headerText='Status' width='50'>
                                <ng-template #template let-clientData>
                                    <label class="switch">
                                        <input type="checkbox" [checked]="clientData.isActive" [(ngModel)]="clientData.isActive">
                                        <span class="slider round"></span>
                            <e-column field="selectedBO" headerText="Beneficial owner" width="100">
                                <ng-template let-clientData #template >
                                    <ejs-multiselect id='boForClients' placeholder='Benificial owner' name="boForClients"
                                        [dataSource]='clientData.boForClients' [fields]='fields' (close)="onClose($event)"
                                          [selectAllText]='selectAllText' [(ngModel)]="clientData.selectedBO" [(value)]="clientData.selectedBO"
                                        showDropDownIcon='true' showSelectAll=true floatLabelType="always">

the json used is: Sample

clientData=[ {clientId=1, clientName='abc',boForClients={item_id:'1',item_text:'ssss'},selectedBO=null,isActive=null}]


   "@syncfusion/ej2-angular-base": "^20.3.56",
    "@syncfusion/ej2-angular-buttons": "20.3.56",
    "@syncfusion/ej2-angular-calendars": "^20.3.56",
    "@syncfusion/ej2-angular-charts": "^20.3.56",
    "@syncfusion/ej2-angular-dropdowns": "^20.3.56",
    "@syncfusion/ej2-angular-grids": "^20.3.56",
    "@syncfusion/ej2-angular-inputs": "^20.3.56",
    "@syncfusion/ej2-angular-navigations": "^20.3.56",
    "@syncfusion/ej2-angular-pivotview": "^20.3.56",
    "@syncfusion/ej2-angular-popups": "^20.3.56",
    "@syncfusion/ej2-angular-progressbar": "^20.3.56",
    "@syncfusion/ej2-angular-splitbuttons": "^20.3.56",
    "@syncfusion/ej2-angular-treegrid": "^20.3.56",
    "@syncfusion/ej2-base": "^20.3.56",
    "@syncfusion/ej2-data": "^20.3.56",
    "@syncfusion/ej2-grids": "^20.3.56",
    "@syncfusion/ej2-svg-base": "^20.3.56",

VB Vinitha Balasubramanian Syncfusion Team November 17, 2022 12:14 PM

Currently, we are validating your reported problem with your shared information, and we will update you the details shortly. Until then we appreciate your patience.

VB Vinitha Balasubramanian Syncfusion Team November 18, 2022 11:04 AM

From your query, we suggest you use blur event of Multiselect Dropdown component. In this event, we get the change value when focus-out from Multiselect Dropdown and it will update to Grid dataSource using setRowData method of Grid.

Now you can get the updated Grid row details using Grid’s dataSource property while click on submit button.

Note: You should define the column.isPrimaryKey property in unique Grid’s column.

Please refer the below code example and sample for your reference.



 <button (click)="saveAction($event)">Submit</button>
















      <e-column headerText="Pod Assignment" width="150">

        <ng-template #template let-data>

























 saveAction(args) {



  multiSelectFocusout(args) {

    if ((event as Event).target.classList.contains('e-dropdownbase')) {

      var multiSelectDropdown = event.target.closest('.e-multiselect')


      var rowObj = this.grid.getRowInfo(event.target);

      rowObj.rowData['podAssign'] = multiSelectDropdown.value;







Sample link: https://stackblitz.com/edit/angular-cdv3bb-f5ihng?file=app.component.ts,app.component.html

Help Documentation:     https://ej2.syncfusion.com/angular/documentation/api/multi-select#blur


Live Chat Icon For mobile
Up arrow icon