120
Views
5
Comments
Solved
[OutSystems Data Grid] date column which has only year and month data
Question
data-grid-reactive
Reactive icon
Forge component by Gonçalo Martins

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

it says this is already deprecated by the latest Outsystems UI upgrade.

GridAPI.ColumnManager.GetColumnById ()
OutSystems.GridAPI.GridManager.GetGridById()
OutSystems.GridAPI.GridManager.GetActiveGrid()

Any idea what's the new API replacement ?  pressing f12 just say 'deprecated , please use the new API' and it's not helpful.

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