I have been trying this from the morning.
I am trying to hide the button connected to the database when the field is empty to which is connected to.
the button is # button1
it is connected to a document field in the database.
Please help
Thanks in advance
Pulkesh
Please see the code.
$w.onReady(() => {
wixData.query("#dynamicDataset1")
.count()
.then((num) => {
let url = $w("#button1").link;
if (url === "") {
$w('#button1').collapse();
}
})
.catch((error) => {
let errorMsg = error.message;
let code = error.code;
});
});
Hello again,
i think this video will help you to understand a little bit more about how to work with them…
How to pick-up some of repeated elements…
$w("#myRepeater").forItems( ["item1", "item4"], ($item, itemData, index) => {
$item("#repeatedImage").src = itemData.img;
$item("#repeatedText").text = itemData.description;
} );
Hello Russian Dima,
Sorry, but i did not found the hiding procdeure in that video.
I simply want to hide the button that is in the repeater, if the documents are not present in the field.
Can you help with that please?
Thanks
Pulkesh
Describe what you want to achieve? How works your site?
I see a table a repeater a button and a dynamic dataset.
What are the interactions between all these elements?
EDIT:
Why did you put the button into the REPEATER?
Hello Russian Dima,
The repeater (# repeater 1) has container which has a download button (# button1) in it.
This button is to download the documents from the database (Members Database).
The field key is (clientSheet) for the documents in the database.
The idea is to hide the download button or better the container when the field key column (clientSheet) is empty in the database.
I connected the repeater to the database. through dataset (dynamicDataset1)
EDIT: I want to add multiple lists of clients in the database for the members.
but that (clientSheet) column is sometimes left empty.
Through repeater, they can get the document to download, only which are uploaded. As I am trying to hide the container. for the documents which are not present.
Thanks again
Pulkesh
Take a look at my site here…
https://russian-dima.wixsite.com/meinewebsite/repeater
I am reconstructiong your situation right now.
You can tell me, if it fits to your needs.
Your example is ready.
Here you can see now 2 different examples how to handle your issue.
You can use either a REPEATER as you wanted, or a table.
And my opinion is still the same, you do not need a REPEATER at all
Just click with a double-click onto the choosen item in the table.
All you have to figure out right now, is how to hide the rows or as you want the bottons, if no INPUT-DATA exists in row (reference).
How to do it?
You know the currend selected index of the row by clicking on a table-row.
Here some code… (You will also find this CODE in my already mentioned EXAMPLE.
import wixLocation from 'wix-location';
$w.onReady(() => {
$w('#dataset1').onReady(() => {
$w('#table1').onRowSelect(event => {
const currentRowIndex = event.rowIndex;
const item = $w('#dataset1').getCurrentItem();
const itemTitle = item.title
const videoURL = item.videoUrl.toString();
const dynamicURL = item["link-tutorials-title"];
$w('#BTNgo').link = dynamicURL;
console.log("Item-Title = " + itemTitle)
console.log("Row-Index = " + currentRowIndex);
// console.log("videoURL = " + videoURL);
// console.log(dynamicURL);
$w('#table1').onDblClick(() => {
console.log("videoURL = " + videoURL);
wixLocation.to(videoURL)
})
$w('#BTNgo').onClick(() => {
wixLocation.to(videoURL)
})
})
});
});