Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Custom display format for cell
posted

I have a numeric field that contains a number of minutes. In the XamGrid, I want to display it as: x Days y Hours Z Minutes. 

It is easy enough to add a property/field to the entity that converts it to the desired format, but then the sorting of the column will not work as intended. 

I figure there are two options: find a way to use a custom format for the displaying of the field, or have the column set to the formatted field and have it sort on the original field. 

As far as I can tell, it is not possible to set a column's sort to another field (not yet, anyway - there was some talk on it perhaps being added). There is the option to add the FieldSortDescription, but that seems to apply to the whole grid, and not a specific column - or did I get that wrong? 

Is there a way to have the display formatting done in code? It would be extremely handy to be able to specify a method (that takes the field value as a parameter and returns the formatted result) as the format property. What is the best way to achieve this?