[Data Grid] Custom Date format

Forge Component
(38)
Published on 3 Aug (22 hours ago) by OutSystems R&D
38 votes
Published on 3 Aug (22 hours ago) by OutSystems R&D

How to set custom format for date column?
I've tried AdvancedFormat "format: 'MMM-dd-yy'"
but it had no effect in demo app for dueDate column . 

Also if I have CellRenderer function that replaces null value( with custom text like "n/d" it works for text column type but not date. 


Hi,

In the following link: https://outsystemsui.outsystems.com/DataGridSample/Formatting.aspx says that the format date can be changed on the service center.

Hope it helps,

Yes, that's an option but that will have affect on the whole module.... I want to have different format on this specific screen. 

Mykola (Nick) Tkachenko wrote:

Yes, that's an option but that will have affect on the whole module.... I want to have different format on this specific screen. 

 

 

Hi Nick

Sorry for digging up this old post. Did you found a solution to this issue?

I have the same problem now. Any suggestions will be appreciated.

Best Regar

Hello to all,

Thanks for bringing this subject to the discussion.

The DataGrid team has been analyzing this topic and we are trying to validate if this is an additional feature that we are going to include on the next releases.
In the meanwhile, we created a sample (attached to this message) that has a workaround type of solution that we hope you can use.


Right after you choose the date that you want, and click Enter or click outside of the cell that is currently in edition mode, the date will adapt to the format that you are trying to apply.


To do this, you will need to include a Web Block containing all the methods that you want to generate in order to format the cells from a specific column. (This block is included in the sample attached)


Inside the Web Block you will find some Javascript responsible for this formatting mechanism.


Then, if you define the OSCellRenderer from the Date Column, to use the method that you created in the previous step, you will end up with the corresponding format.


Remember that by using this extended feature, the methods related to the formatting of the cells will get overwritten. Specifically, the method formatItems.

Hope this sample is useful if you need to extend DataGrid to have the format that you want for a specific column.


Tiago Pereira