Hi
DateFrom) in the grid. I added a Column name NumDay to the grid but it does not work.
Hi sao,
Greetings from Syncfusion support.
We Checked your Query, we prepared sample as per requirement calculate age in a blazor grid and display it in a column attached in this ticket. Please kindly refer the attached sample for your reference.
Please get back to us if you have further queries.
Regards,
Naveen Palanivel
Dear Naveen,
The approach you provide is working well when the NowDate filed contains a valid date. However, I note that this approach is not so practical when Datagrid has thousand of rows as each row required the updating of Nowdate field and It may require human resources to update the NowDate every day (which is not very practical).
Does the Datagrid have the ability to compute the Age based on the other field (eg. Date of Birth) and presented in an unbound column in the said Datagrid?
I found an article related to this but it is not in Blazor (https://www.syncfusion.com/forums/151510/want-to-add-a-age-column-based-on-a-calculation-off-date-of-birth)
Best regards
Sao
Hi Sao,
We suggest you to use the Column Template feature of grid. With this feature you can render a custom content/valued column in grid.
Reference :
https://blazor.syncfusion.com/documentation/datagrid/column-template
https://blazor.syncfusion.com/demos/datagrid/column-template?theme=fluent
Query : Does the Datagrid have the ability to compute the Age based on the other field (eg. Date of Birth) and presented in an unbound column in the said Datagrid?
So now based on your requirement you can access the entire row data of grid using the context inside Template. Now you can perform your own calculation and return the sum you need to display in the calculated grid column. You can customize your own actions inside the Template tags of GridColumn.
|
<GridColumn HeaderText="Order Date" Width="130"> <Template> @{ var value= (context as Order); //here get complete row data //perform your custom action get complete row data } </Template> </GridColumn>
|
Please use the above suggestion and check this from your side and get back to us if you need further assistance.
Regards,
Renjith R