Dear community,
I have a menu with links to a market place. This market place exists on one DB.
Is it possible to have a menu page which would link to the general market place, but pre-select a category to display.
Menu:
When pressed on, I would like the link to take the user to this page, but having pre-selected one of the fields in this category:
(you probably know, but I’m not trading kittens ^^', this is just the repeaters default image).
Thank you very much
@ohadloffler It’s not entirely clear how you have this set up, but you might be able to have a field store the default category to display. Then in the onReady event of the page, set the dropdown value to that. Or you may need to pass a choice made in the source page (menu) to the destination page (market place) to make this happen. The wix-storage API could be utilized for that, using setItem in the source page and getItem in the destination page.
Thank you very much for your answer Anthony.
I’m trying to use the wix-storage API with setItem.
On the menu page I have set up a repeater on which I have the items (Agriculture, Food, Non-Food, Basic and Household). The image links to the Market.
On the Menu page I have this code now (I have tried to start with the “Food” item):
------ MENU PAGE
import wixData from ‘wix-data’ ;
import {session} from ‘wix-storage’ ;
export function image2_click(event) {
session.setItem( “menu” , “food” );
}
On the Market page I have:
------ MARKET PAGE
import wixData from ‘wix-data’ ;
import {session} from ‘wix-storage’ ;
$w.onReady( function () {
});
// MENU SELECTION
let menu = session.getItem( “menu” );
$w( ‘#dataset1’ ).setFilter(wixData.filter().contains( ‘section’ , menu))
//SEARCH BAR
export function input1_keyPress(event) {
//Add your code for this event here:
let searchvalue = $w( ‘#input1’ ).value;
$w( ‘#dataset1’ ).setFilter(wixData.filter().contains( ‘title’ , searchvalue)
.or(wixData.filter().contains( ‘comment’ , searchvalue)))
}
// DROP DOWN CHOICE
export function dropdown1_change(event) {
let section = $w( ‘#dropdown1’ ).value;
$w( ‘#dataset1’ ).setFilter(wixData.filter().contains( “section” , section))
}
At the moment it’s not working. I also understand that I should use a:
session . removeItem ( “key” );
When user chooses a value on dropdown or search bar, otherwise the session storage would override, correct?
Thank you
I wonder if the lack of answer is due to the fact that (I realised later) the repeater has the same ID for all elements? Or is it perhaps another reason?