cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Question: I want to use the Date picker for filtering, however, the dates selected are not getting preserved by the date picker and might be confusing for the end users whether the date is selected or not.
Solution: You can use the script to keep the selected values in the filter.

widget.on('ready',function(se,ev){

if (!Array.isArray(se.queryResult)) return;

var minMax = se.queryResult.reduce(function(acc, val){
if((!acc.min) || acc.min>val[0].Value){acc.min = val[0].Value}
if((!acc.max) || acc.max<val[0].Value){acc.max = val[0].Value}
return acc
} , {min:undefined,max:undefined})


formatted_dateFrom = moment(minMax.min).format('YYYY-MM-DD')
formatted_dateTo = moment(minMax.max).format('YYYY-MM-DD')

document.getElementById("data.filters[0].filterJaql.from").value=formatted_dateFrom
document.getElementById("data.filters[0].filterJaql.to").value=formatted_dateTo

document.getElementById("data.filters[0].filterJaql.from").setAttribute("style", "text-align:center");
document.getElementById("data.filters[0].filterJaql.to").setAttribute("style", "text-align:center");

})
This will pull the values for you.
Version history
Last update:
‎03-02-2023 08:32 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

Sisense Privacy Policy