Hi,
I have been searching the forums and can’t seem to find and answer.
I have a database, a repeater that shows me that data + a filter where I can select one of the fields and see one type of data at a time.
What I would like to do is when I come to the page where this data is viewable, I would like to change the default filter selection based on where I came from.
export function button6_click ( event ) {
console . log ( “Setting variable for button 6” );
local . setItem ( “key1” , “Jon” );
[wixLocation]( wixLocation.to("URL) [.]( wixLocation.to("URL) [to]( wixLocation.to("URL) [(]( wixLocation.to("URL) ["URL]( wixLocation.to(“URL) in here” );
}
On the new page I can pickup the ‘key1’ variable and print on console.
$w . onReady ( function () {
let x = local . getItem ( ‘key1’ );
console . log ( x ); // This prints out ‘Jon’
// works up to here
-
I first I tried with no success
$w ( “#dropdown1” ). options = x ;
$w ( “#dropdown1” ).label = x ;
$w ( “#dropdown1” ).value = x ; -
Options seems to be a struct with 2 variables. Tried this, but it would seem I need to know the value based on the label. (I could guess based on position in my database, but need this to be dynamic). Even putting in a number here, I get nothing.
let options = [{ “value” : ‘’ , ‘label’ : x }];
$w(‘#dropdown1’).options = options; -
Then I saw a comment that the filtering would not update and that I should be using setFieldValue…
$w(‘#dropdown1’).setFieldValue(“Label”,x);
save();
});
As you can see, this appears to be a simple request, but not so easy to accomplish. Any help would be greatly appreciated!