Hi, I have this problem scenario.
Example: I have 2 users using different PC , when they both access the same page, user1 selected an item from a dropdown element, and when user2 selects an item from the dropdown the item selected from user1 must be hidden or flag as “being selected by the other user”. How am I be able to to that? Any ideas are greatly appreciated. Thank you in advance. Unfortunately I don’t know how to use wixReal-time
Why this is so hard to achieve Why wix doesn’t have this functionality?
Can this be done using wix-realtime? Below is my work around but it has a problem.
$w.onReady(function () {
setInterval(function(){ $w('#dataset1').refresh(); }, 500);
});
export function dropdown1_change(event) {
wixData.query("myDatabase")
.eq("name", $w("#dropdown1").value)
.find()
.then( (results) => {
let values = results.items[0];
values.inProgress = 2;
wixData.update("myDatabase",values)
})
$w("#input2").value = $w("#dropdown1").value;
$w("#input3").value = $w("#dropdown1").value;
$w("#dropdown1").value = "";
$w("#dropdown1").resetValidityIndication();
}
export function cancel_click(event) {
wixData.query("myDatabase")
.eq("name", $w("#input3").value)
.find()
.then( (results) => {
let values = results.items[0];
values.inProgress = 1;
wixData.update("myDatabase",values)
})
$w("#dropdown1").value = "";
$w("#input2").value = "";
$w("#input2").resetValidityIndication();
$w("#dropdown1").resetValidityIndication();
}
export function approved_click(event) {
wixData.query("myDatabase")
.eq("name", $w("#input3").value)
.find()
.then( (results) => {
let values = results.items[0];
values.inProgress = 3;
wixData.update("myDatabase",values)
})
$w("#dropdown1").value = "";
$w("#input2").value = "";
$w("#input2").resetValidityIndication();
$w("#dropdown1").resetValidityIndication();
}