So I have this model with these 2 property
So in my view it works fine. I have the column defined as like this
and I am listening to the excel export as well
where modify excel is defined like this
I also have looked at how to use template as mentioned here, but becuase all my template does is call a js function it did not make sense for me to write code to grab the template to only run the js function.
I also looked at using e.data but the array becomes nested as I group and sort the grid before I export to excel.
Is there a simple way for me to gracmodifyFormatForExcel
8 Answers, 1 is accepted
The "ChangeDate" from the dataItem will be available in the cell within the excelExport event, so you could use it as shown below:
Hope this helps.
@Konstantin Dikov - I checked and
1. row.cells only contains the columns that are are visible. I have a column
columns.Bound(m => m.DateOnlyChangeDate)//hidden column used for grouping
that is hidden and is not a property of rows.cells
2. The ChangeDate property of the model is not used as a column either. It is merely there for me to be able to use to format.
Found this post. Trying to see if it works for me.
Could you please share your Grid configuration and the code that you have for the export? Note that if you are using the e.data collection for the custom code to get reference to the dataItems, you need to take into account the group header rows when traversing the rows in the workbook.
I found a solution that worked for me, and yes, I saw that I needed to account for group header rows for both the workbook and the data source of e.sender (the solution I decided to go with). So for workbook I checked if the row is a data row, and for the data source I flatten it out so it is easy to traverse.
Here is my grid configuration and excel export for the solution I decided to go with
and my excel export function
Opps copied the wrong code for the configuration
This needs to be changed, the cahnge date field is already in ISO 8601 format
I am glad to see that everything is working as per your requirement now. I also want to thank you for sharing the solution with the community.
You should find your Telerik Points updated.