I am trying to implement a filter to fix a problem with the Get Next items in the Dataset.
If I access this page without any search contents, it properly shows the first 10 items, then the Get Next Ten button (linked to database Next Items). It all works as expected.
However, If I search on Color for example and select “Blue” as the value, It retrieves all the Blue items, But the Get Next Ten button is not greyed out. So, if I click that it goes to the database and retrieves the First 10 records which are NOT blue"
Searching this forum I thought I needed to implement a filter in the search statements. Here is my code:
added more/next button.hide when inside the switch statement.
Added a Reset button at top of page along with an onclick event to button.show.
Solves problem with the Color and The Dash#. But there are over 1000 cars in each Year category so hidden more will not allow viewing all of each year. Need Filter on the year and no HIDE more button for that switchase case.
HERE IS REVISED CODE:
//CURRENT REGISTRY SEARCH
export function searchButton_click(event, $w) {
let search = “1”
let i = 0;
if ($w(‘#searchColor’).value !== ‘Color’) search = “3”;
if ($w(‘#searchYear’).value !== ‘Year’) search = “2”;
if ($w(‘#searchDash’).value !== ’ Dash#') search = “1”;
Thanks Tal,
I have somewhat resolved the problem by redesigning how it works… I overrode the default limit set in the database with a limit(xx) and hides the MORE button for the searches. I put a RESET search button which shows the MORE button and in order for it to start over with the items in the database I added…
export function reset_click(event, $w) {
wixData.query(‘CVOA-Registry’)
.between(‘dash’, ‘0000’, ‘0020’)
.limit(12)
.find()
.then(res => {
$w(‘#repeater1’).data = res.items;
} )
$w(“#moreButton”).show();
}
Still have a slight problem in that the FIRST item is '0001". The results from the database skip the first record for some reason.