1
votes

I'm trying to add a dynamic filter to IG. I have a column with date and I want to add a filter on date (today - 14days).

I don't wanna use WHERE clause becouse I need to give the user opportunity to change it with IG options. So I'm trying to use a widget().interactiveGrid().

let today = new Date();
today.setDate(today.getDate()-14);

apex.region("ig_report").widget().interactiveGrid(
    "addFilter",
    {
        type: 'column',
        columnType: 'column',
        columnName: 'DATE',
        operator: 'GT',
        value: today.toISOString().substr(0,10).replace(/-/g,'')
    }
)

and this working quite fine. When I load page it's adding this filter to report. Buut unfortunettly it's not displaying date on filter

enter image description here

but when you click on this filter you can see that there is Value

1

1 Answers

1
votes

That API is not documented and thus shouldn't be used. Assuming you want to use it anyway, you need to add the time portion to the date string as zeros.

Try this:

let today = new Date();
today.setDate(today.getDate()-14);

apex.region("ig_report").widget().interactiveGrid(
    "addFilter",
    {
        type: 'column',
        columnType: 'column',
        columnName: 'DATE',
        operator: 'GT',
        value: today.toISOString().substr(0,10).replace(/-/g,'') + '000000'
    }
)