- Home
- Forum
- Angular - EJ 2
- Grid 'Batch' editing does not work on column with dropdownlist with object binding
Grid 'Batch' editing does not work on column with dropdownlist with object binding
Hi,
I am struggling to make batch edit mode work on column edited via a dropdown list bound to an object (Country with attributes {id, label, code}). The problem does not occur in Inline editing. I attached my code for reproduction.
When the previous column's value is empty/undefined and then I select a value from the dropdown list, the cell is correctly highlighted as dirty (via light green background color):
| Initial Load with Country empty | |
| Country changed |
|
| I save the changes via Update button | |
| Now, I edit again the cell and select another country. The cell is not highlighted as "dirty". |
As you can see in the last step above, the cell was not highlighted as "dirty" and the Update button was not enabled.
This problem does not occur when the cell is bound to a primitive value.
Do you know how to overcome this problem, please ? Maybe someone can guide me to use a hook to override the cell "equal" logic between "peviousValue" and "value to support object binding ?
I tried override the behavior with IEditCell interface without success.
Please find my code below (Syncfusion version 29.1.x):
Hi ,
Greetings from Syncfusion support,
We have noticed that you have used object data for country column and rendered its label value by using column template. To access the value in the object, you can use the complex data binding to directly access nested values. By specifying the field property with a dot (.) notation (e.g., country.label), the grid will automatically bind to the correct property. Additionally, in the cellSave event, store the label value instead of entire object. This approach simplifies data handling and ensures proper binding.
Please refer to the below code snippet and sample for more information.
|
<e-column
uid="country" field='country.label' headerText='Country'
width='140' textAlign='Right' > cellSave(args: any) { if(this.drowpdown) { args.value = (this.drowpdown.value as any).label; } } |
Documentation : https://ej2.syncfusion.com/react/documentation/grid/columns/column-rendering#complex-data-binding
Sample : https://stackblitz.com/edit/angular-kmddwkc3?file=src%2Fapp.component.ts
If you need further assistance, feel free to let us know!
Regards,
Kishore Muthukrishnan
Hi Kishore,
Thank you very much for your answer.
Indeed when bind the column's field to "country.label" and update "cellSave" to what you suggest, I get the cell switch to dirty style as expected. However, this raised another problem: the "country" column does not contain any more the object "country = {id="x", label="y", code="z"}" but only the label because of "cellSave" logic.
Do you have another way to keep the object bound the column "country" ?
Thanks in adance,
Sam
Hi ,
The Syncfusion EJ2 Grid supports the following column types: string, number, boolean, date, datetime, and checkbox. These types allow for appropriate formatting, filtering, and editing based on the underlying data type.
If you are working with nested data, the grid also supports complex binding. This means you can bind to a specific field within a nested object (e.g., employee.name). However, please note that only the specified field is retrieved and rendered in the grid, not the entire nested object. This is by design and is the default behavior of the grid to ensure optimal performance. Please refer to the below documentation for more information about column types.
Documentation: https://helpej2.syncfusion.com/angular/documentation/grid/columns/columns#column-types
Regards,
Kishore Muthukrishnan
Hi Kishore,
Thank you very much for your answer.
I continued to bind complex object as you advised but I am facing a new issue related to complex object binding in Excel type filtering ([filterSettings]='{ type: "Excel"}') of ejs-grid. When the nested object in the row data is not null, the filtering is working as expected as you can see below:
Filtering on column residence country:
When the row contains a null nested object (for instance, birth country column has a null value), the filter popup throws an error:
When I hover on ">" arrow, I get this error:
Is this a bug or mis-usage of the feature ?
Here is the code you can test:
Thanks in advance
Hi,
We have reviewed you query, it appears that the first value of the Country column in your data source is null. When this happens, and the type property is not explicitly defined in the column configuration, the Grid will infer the column type based on the first available value. Since the first value is null, the column.type becomes null, which causes an error when opening the filter dialog—because the filter UI is rendered based on the column type.
To resolve this issue, we recommend explicitly setting the type property in the column definition. This ensures that the filter dialog renders correctly regardless of the initial data value
The code snippet of the implementation and sample have been attached for your reference.
|
<e-column field="country.label" headerText="Country" width="140" type="string" textAlign="Right" >
|
Sample: https://stackblitz.com/edit/angular-plbv65pw?file=src%2Fapp.component.html,src%2Fapp.component.ts
Image:
Please get back to us for further assistance.
Regards,
Dineshnarasimman M
Thank you very much. Specifying the column type resolves the problem.
Hi,
Thanks for the update. We were glad that the provided suggestion resolved your issue. Please get back to us for further assistance.
Regards,
Dineshnarasimman M
- 7 Replies
- 3 Participants
-
ID Issam DANO
- Apr 1, 2025 06:20 PM UTC
- Jun 17, 2025 05:00 AM UTC