// For full API documentation, including code examples, visit https://wix.to/94BuAAs
import wixLocation from "wix-location";
export function dropdown1_change(event, $w) {
let option = ($w("#dropdown1").value);
if (option === "Microsoft Powerpoint") {
$w("#button8").link = "www.owheeler. com/about";
$w("#button8").target = "_blank"; // same window or new window _blank
} else if (option === "Google Slides") {
$w("#button8").link = "www.owheeler. com/home";
$w("#button8").target = "_blank"; // same window or new window _blank
}
}
import wixLocation from "wix-location";
$w.onReady(function () {
});
export function button1_click(event) {
let option = $w("#dropdown1").selectedIndex
if ( option === 0 ) {wixLocation.to(["link-tutorials-title"]);}
}
An example of this page …(Tutorial-Overview) with its table where you can see all the data loaded from a data-collection, wich is connected with a DATASET.
The 2 corresponding colums in the database you see above in the pics.
export function table1_rowSelect(event) {
setTimeout (()=>{
$w('#dataset1').onReady( () => {
let currentRowIndex = event.rowIndex
console.log(currentRowIndex)
let URL = $w('#dataset1').getCurrentItem().url
console.log(URL)
console.log($w('#dataset1').getCurrentItem().title)
console.log($w('#dataset1').getCurrentItem().tutorial)
console.log($w('#dataset1').getCurrentItem().index)
let myURL = $w('#dataset1').getCurrentItem()["link-tutorials-title"]
let contentLink1 = $w('#dataset1').getCurrentItem()["link-tutorials-title"]
console.log(myURL)
$w('#BTNgo').link = myURL
} );
},1)
}
By selecting a row, the current data loads and also the corresponding URL is loaded to the button (“Forum-Post” & “GO”). “BTNgo” gets the dynamic link.
@russian-dima thank you very much for the explanation: I really appreciate it.
For completeness and to help both me and others who might have this same question, how would the same function be used for static web pages within 1 website. For example, if you had a drop down linked to a data set (apple, orange, pear, etc.) which linked to a detailed page for each selection (apple) .
Actually, after asking the question here, I ‘hunted’ around a bit - and got together various pieces of code to get the following - which seems to be working…