Question regarding navigation:

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:

Looking at your code, a lot of questions comes into my mind…

  1. Why queriying ( “Juices” ) all the time, again and again and again and loosing PERFORMANCE?

  2. Why using Wix-Data and do some queries but than writing wrong console.logs —> console . log ( “Dataset is now filtered” ); any dataset was filtered a this point. You are not using any dataset at any of your code-lines.

  3. I think you are trying to do something, which could be maden in a more simple way.

Perhaps you try to describe your issue you are working on.

  1. How do look like your project-setup?
    a) Database?
    b) Dynamic-pages?
    c) Repeater?
    d) datasets? (dynamic or normal) ?
    e) Are you using a custom navigation-bar or the standard one?
    …and so on…

  2. How do look like your project-flow?

  3. When you press onto … —> than something happens.

The better you describe your situation, the better someone can help you.