- Home
- Forum
- ASP.NET Core - EJ 2
- I have a calculated column in an ej grid that I don't want to display on the modal form.
I have a calculated column in an ej grid that I don't want to display on the modal form.
Hi
I have a calculated column in an ej grid that I don't want to display on the modal form. How do I implement this? And how do I get the export to excel to display the value, currently it is exporting an empty column.
SIGN IN To post a reply.
3 Replies
BS
Balaji Sekar
Syncfusion Team
February 20, 2020 12:06 PM UTC
Hi Basil,
Greetings from Syncfusion support.
Before proceeding further can you please let us know if you are using our EJ1 Grid or EJ2 Grid. Based on the information we will provide you the solution for the query.
Let us know if you have any concerns.
Regards,
Balaji Sekar.
BB
Basil Buwalda
February 20, 2020 09:27 PM UTC
EJ2 grid
BS
Balaji Sekar
Syncfusion Team
February 21, 2020 12:49 PM UTC
Hi Basil,
Thanks for your update.
Query – 1: “I have a calculated column in an ej grid that I don't want to display on the modal form.”
Based on your query we suspect that your requirement is to prevent editing for a particular column. You can achieve this by setting the column’s allowEditing propery to false which prevents the column from being edited.
|
<e-grid-columns>
.
.
<e-grid-column field="EmployeeID" allowEditing="false" headerText="Employee ID" width="150"></e-grid-column>
</e-grid-columns> |
If we misunderstood your query please get back to us with the details along with the edit type and template(if any) you have used in the grid.
Query – 2: “How do I get the export to excel to display the value, currently it is exporting an empty column”
Since the column value is dynamically calculated and assigned this value will not be present in the data source. While exporting the grid gets the value from the data source and since this column value will be null, empty column will be exported.
So if you wish to export the columns with the dynamically calculated values, then you would need to perform the same operation in the excelQueryCellInfo event(Triggers before exporting each cell) and assign the calculated value to the arguments value property as demonstrated in the below code snippet,
|
// Grid’s excelQueryCellInfo event function
excelQueryCellInfo(args) {
// Check if it is the calculated column
if (args.column.field === 'Total') {
// Here perform the same operation for dynamically calculating the value and assign it to the value property
args.value = Number(args.data.Quantity * args.data.Freight).toFixed(2);
}
} |
Let us know if you have any concerns.
Regards,
Balaji Sekar.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
BB Basil Buwalda
- Feb 19, 2020 11:59 PM UTC
- Feb 21, 2020 12:49 PM UTC