I have a product database
Products have a text field named ‘‘status’’:
New, old, outdated … etc.
The thing is, I have a box for each state
New = box1
old = box2
etc.
(Inside each box I have fields associated with that product in question)
What i want is that
If in the database the value of Status is equal to ‘’ New ‘’
Box2, box3 and box4 collapse
And the opposite case for the other values.
Thanks u
Hello Yair,
then you will need…
$w('#myBox').collapse()
How to get a value in database?
import wixData from 'wix-data';
// ...
wixData.query("myCollection")
.find()
.then( (results) => {
if(results.items.length > 0) {
let firstItem = results.items[0]; //see item below
} else {
// handle case where no matching items found
}
} )
.catch( (err) => {
let errorMsg = err;
} );
…or by using the DATASET…
$w("#myDataset").getItems(3, 2)
.then( (result) => {
let items = result.items;
let totalCount = result.totalCount;
let offset = result.offset;
} )
.catch( (err) => {
let errMsg = err.message;
let errCode = err.code;
} );