[Data Grid Reactive] date column which has only year and month data
Question
Forge component by OutSystems R&D

hi

i want to make a column which has year and month information. day is not needed. like this: Apr 2021

in this case,  i think two ways exist.

 1) a  text column used.  the format is checked by an action after changed.

 2) two drop down columns used. 


do you have any other ideas to resolve it?

Solution

Hello @Jiro Yamarda

In order to achieve your requirement you need to add these JS lines on a JS Node in the Page OnReady action that contains the grid:

GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.editor.selectionMode = 'Month';

GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.editor.format = "MMM yyyy";


GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.format = "MMM yyyy";


This will allow you to achieve this behavior:

In attachment, you can find a sample OML with this implementation.

Please keep in mind that this hasn't been tested for all possible use cases or that it cover all of your requirements, so we cannot assure that it will work for all use cases.

Please let us know if this helps.

Bruno Martinho

CustomDatePicker.oml

Hello @Jiro Yamada,

Can you please give some more info, in terms of the way you want to store the information?

Is it a string like Apr 2021 that you store in the database?

Bruno Martinho


this is the thing i want to do

Solution

Hello @Jiro Yamarda

In order to achieve your requirement you need to add these JS lines on a JS Node in the Page OnReady action that contains the grid:

GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.editor.selectionMode = 'Month';

GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.editor.format = "MMM yyyy";


GridAPI.ColumnManager.GetColumnById($parameters.ColumnWidgetId).provider.format = "MMM yyyy";


This will allow you to achieve this behavior:

In attachment, you can find a sample OML with this implementation.

Please keep in mind that this hasn't been tested for all possible use cases or that it cover all of your requirements, so we cannot assure that it will work for all use cases.

Please let us know if this helps.

Bruno Martinho

CustomDatePicker.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.