Hi Ahmed
You don’t need to query to get the ID of the current item, you just need to to use the getCurrentItem() function, then extract the ID from it.
$w.onReady(()=> {
('#dataset1').onReady(() => {
let item $w('#dataset1').getCurrentItem();
let itemId = item_id; // This is the item ID
console.log(item._id)
$w('#videoPlayerYoutube').src = item.urlYoutube;
$w('#buttonServer1').onClick((event) => {
$w('#videoPlayerYoutube').src = item.urlYoutube;
})
$w('#buttonServer1').onClick((event) => {
$w('#videoPlayerYoutube').src = item.urlFacebook;
})
})
})
Hope you find this useful~!
Ahmad
thank Ahmed for reply
my code don’t work
I want to when click button 1 show video YouTube or button 2 show video Facebook
export function buttonServer1_click(event) {
$w.onReady(()=> {
$w('#dataset5').onReady(() => {
let item =$w('#dataset5').getCurrentItem();
$w('#videoPlayerYoutube').src = item.urlYoutbe;
})
})
}
export function buttonServer2_click(event) { $w.onReady(()=> {
$w('#dataset5').onReady(() => {
let item= $w('#dataset5').getCurrentItem();
$w('#videoPlayerYoutube').src = item.urlFacebook;
})
})
}
Here you go …
Two event handlers were created, default video source set to YouTube.
The answer above got updated.
yes
when click any button get other video from other page
how fixed
What do you mean? Fix what?