Hi,
As I can’t filter in the dataset parameters on a date-time field, I need to populate the table at page opening with code.
But where should I put this code ? I tried in the “page1” property “onViewportEnter”, but it does not work. Or is it possible to put only some filtering with code somewhere, as apparently anyway the dataset is loaded with the page if I want the columns linked with the collection…
This is the code I could use for that:
$w('#dataset1').onReady(() => {
let dpd = $w('#dropdown1').value;
var lowerYear = dpd.substring(0,4);
var upperYear = dpd.substring(5,9);
var lowerDate = new Date(lowerYear.concat('-','9','-','1'));
var upperDate = new Date(upperYear.concat('-','6','-','30'));
wixData.query('match')
.gt('dateHeure', lowerDate)
.lt('dateHeure', upperDate)
.descending('dateHeure')
.limit(300)
.find()
.then( (res) => {
let tableRows = res.items;
$w('#table1').rows = tableRows;
})
})
}