Hi! I’ve integrated a Date Range Picker to update two hidden inputs (“date from” and “date to”) programmatically. However, I’m facing challenges in refreshing the CMS filter to reflect these changes. Triggering various events didn’t yield results. Interestingly, manually modifying either input (even adding a space) updates the filter, but it doesn’t consider the value of the second input that wasn’t manually altered. Could you guide me on how to refresh the filter when these input values are changed programmatically?
Thank you for your assistance.
Just in case:
$('input[ms-code-input="date-range"]').daterangepicker(
{
timePicker: true,
timePickerIncrement: 30,
ranges: {
Today: [moment(), moment()],
Tomorrow: [moment().add(1, "days"), moment().add(1, "days")],
"Next 7 Days": [moment(), moment().add(6, "days")],
"Next 30 Days": [moment(), moment().add(29, "days")],
"This Month": [moment().startOf("month"), moment().endOf("month")],
"Next Month": [
moment().add(1, "month").startOf("month"),
moment().add(1, "month").endOf("month"),
],
},
alwaysShowCalendars: true,
startDate: "12/13/2023",
endDate: "12/19/2023",
drops: "auto",
},
function (start, end, label) {
$("#date-from")
.val(start.format("MMM DD YYYY HH:mm"))
.trigger("change")
.trigger("input")
.trigger("keyup")
.trigger("blur");
$("#date-to")
.val(end.format("MMM DD YYYY HH:mm"))
.trigger("change")
.trigger("input")
.trigger("keyup")
.trigger("blur");
console.log(
"New date range selected: " +
start.format("MMM DD YYYY HH:mm") +
" to " +
end.format("MMM DD YYYY HH:mm") +
" (predefined range: " +
label +
")"
);
}
);