I have a repeater with a filter for juice types, (image attached) when im at the navigation bar, i want to click on the “green juice” text and make it redirect to the juices page where the repeater is only filtered to green juice. I have tried wixlocation.queryparams.add but seems that the queryparams only work on the page itself and if i have to link it to the “green juice” in the navigation bar, it just leads to the general page. if i could get some advice and help on this would be great
what this currently does is, when i click on green juice, the weblink for image 2 shows up, how can i make the picture below show up when i key in this link Juices (coldpressindex.com) instead of everything. my code is as follows for the filter.
export function greenjuice_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixData . query ( “Juices” )
. contains ( “category” , “Green Juice” )
. find ()
. then (( result ) => {
if ( result . items . length > 0 ) {
let items = result . items ;
console . log ( “Dataset is now filtered” );
filters ={ “category” : “greenjuice” };
wixLocation . queryParams . add ( filters );
$w ( “#repeater1” ). data = items ;
// wixLocation.to(url + filters);
} else {
console . log ( “no items exist!” );
}
}). catch (( err ) => {
console . log ( err );
});
}
/**
- Adds an event handler that runs when the element is clicked.
- @param {$w.MouseEvent} event
*/
export function fruits_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixData . query ( “Juices” )
. contains ( “category” , “Fruit-Forward” )
. find ()
. then (( result ) => {
if ( result . items . length > 0 ) {
let items = result . items ;
filters ={ “category” : “Fruit-Forward” };
wixLocation . queryParams . add ( filters );
console . log ( “Dataset is now filtered” );
$w ( “#repeater1” ). data = items ;
} else {
console . log ( “no items exist!” );
}
}). catch (( err ) => {
console . log ( err );
});
}
/**
- Adds an event handler that runs when the element is clicked.
- @param {$w.MouseEvent} event
*/
export function roots_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixData . query ( “Juices” )
. contains ( “category” , “Roots” )
. find ()
. then (( result ) => {
if ( result . items . length > 0 ) {
let items = result . items ;
filters ={ “category” : “Roots” };
wixLocation . queryParams . add ( filters );
console . log ( “Dataset is now filtered” );
$w ( “#repeater1” ). data = items ;
} else {
console . log ( “no items exist!” );
}
}). catch (( err ) => {
console . log ( err );
});
}
/**
- Adds an event handler that runs when the element is clicked.
- @param {$w.MouseEvent} event
*/
export function cleansesets_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixData . query ( “Juices” )
. contains ( “category” , “Cleanse Sets” )
. find ()
. then (( result ) => {
if ( result . items . length > 0 ) {
let items = result . items ;
wixLocation . queryParams . remove ;
filters ={ “category” : “Cleanse Sets” };
wixLocation . queryParams . add ( filters );
console . log ( “Dataset is now filtered” );
$w ( “#repeater1” ). data = items ;
} else {
console . log ( “no items exist!” );
}
}). catch (( err ) => {
console . log ( err );
});
}
navigation bar: