On a page displayng items, the user has a button that allows to extract some data dand allow him to work with it outside the application. By code, I use wixquery to extract the appropriate data, format it and push to the clipboard . Yhe user can then pass it to Excel and do what he wants with it.
As nothing is visible when the code is performed, I would like to give some information saying that the operation was successful (or not) and requested data is available in the clipborad. (like a messagebox in other languages).
I did not find any way to perform this?
What is the best simple method for displaying this message?
Claude
Do you have any code currently ??
I can’t guess your code (naturally)
But, this may help you →
https://support.wix.com/en/article/corvid-working-with-promises#then-1
FOr information the code is :
export function buttonExport_click(event) {
wixData.query( "jobApplication01" )
.limit( 1000 )
.ascending( 'nomDeFamille' )
.find()
.then( (results) => {
//const NbRecords = results.items.length;
var ExportString;
ExportString = “” ;
//console.log(NbRecords);
//console.log(results.items);
const Tab = String.fromCharCode( 9 );
const CRLF = String.fromCharCode( 10 );
var LocalDate;
// handle comuln titile
ExportString += "nomDeFamille" + Tab
ExportString += "prenom" + Tab
ExportString += "email" + Tab
ExportString += "Nombre personnes" + Tab
ExportString += "DateInscription" + CRLF
//loop to load data requested
for ( var i = 0 ; i < results.items.length; i++) {
// conversion date
LocalDate = results.items[i].submissionTime;
LocalDate = LocalDate.toLocaleDateString();
ExportString += results.items[i].nomDeFamille + Tab
ExportString += results.items[i].firstName + Tab
ExportString += results.items[i].email + Tab
ExportString += results.items[i].numero + Tab
ExportString += LocalDate + CRLF
}
//console.log(ExportString);
wixWindow.copyToClipboard(ExportString);
//That is where I want to confirm that data is available in clipboard ???
} );
}
Try this →
If you want to open a lightbox after the ‘copyToClipboard’ function →
wixWindow.copyToClipboard(ExportString)
.then(() => {
wixWindow.openLightbox("LightboxName");
});
Instead of “LightboxName” put your lightbox’s name…
If you want to show a box after the ‘copyToClipboard’ function →
#box1 - box to show
wixWindow.copyToClipboard(ExportString)
.then(() => {
$w('#box1').show();
});
I never heard about Lightbox before, so I had a look on the documentation and I tested, and it is exactly what I wanted. Many thanks.
Your Welcome !!!
…to know that it was useful !!