I went one more time through your code and i did not find any codepart, which opens a LIGHBOX. I must be blind!
The lightbox is triggered once the “sendsms” button is clicked. See the lightbox below.
Ok, first thing i do not see any “sendsms” button, but i assume it will be → " Send Text " with unknown button-ID out of my point of view.
I would suggest you to clear-up your code first, naming all your elements the right way.
What does mean the right way?
Naming your elements the right way in CODING-WORLD means, you do never use inside your code something like …
‘#button1’
‘#button21322’
‘#button9999’ … and so on!
Instead you use something like…
‘#btnViewRemsume’
‘#btnSendEmail’
‘#btnSendText’
[ btn stand for ? → yes, for → BUTTON ]
If you already would have used the mentioned button-IDs earlier, i maybe already would have understood your real problem much faster and easier, because extern CODER, would be able to read your code much better, by recognizing each of elements the easy way.
Another problem you have, it the fact that you surely use a mix of connected button-functions to dataset, and some functions which are handled by code.
For example, as already mentioned, nowhere inside your code can be found the command-line, wich opens the LIGHBOX!
This is not good! Why? → Because this way you are forced to use Wix-Storage.
Yes it is a solution, but there is another better way of how to send DATA between page and LIGHBOX and it is already integrated inside the LIGHBOX-API itself.
And this was not the only reason why not to mix CODE and PREDEFINED STUFF.
Either go the one way, or the other. Mixing both, sooner or later will end in chaos, errors or dead end.
Excerpt from the VELO-API…
/*************
2 * Page Code *
3 *************/
4
5import wixWindow from 'wix-window';
6
7export function openButton_click(event) {
8 wixWindow.openLightbox("MyLightBox", {
9 "pageSend1": $w('#pageSend1').value,
10 "pageSend2": $w('#pageSend2').value
11 })
12 .then( (data) => {
13 $w('#pageReceive1').text = data.lightBoxSend1;
14 $w('#pageReceive2').text = data.lightBoxSend2;
15 } );
16}
The same for REPEATER!
We can cleary see a REPEATER, but we do not see any CODE FOR REPEATER, yes because you use again a DATASET.
The way you go is possible, but could get complicated.
Ok, however, lets switch back to your issue…
Let us take the new button-IDs inside our code…
‘#btnViewRemsume’
‘#btnSendEmail’
‘#btnSendText’
‘#btnCalendar’
You recognize which buttons are meant , regarding your own pic ?
I think my first suggestion was wrong.
import {session} from 'wix-storage';
//----------------------------------------------------------------------------
//-------------------------PAGE-CODE------------------------------------------
//----------------------------------------------------------------------------
$w.onReady(()=> {
// SAVING DATA INTO WIX-STORAGE (MEMORY-FUNCTION)...
$w('#input1').onChange(event => {
session.setItem('value', $w('#input1').value);
});
//The following happens when DATASET IS READY TO BE USED....
$w("#dataset1").onReady(()=> {console.log("Dataset is fully ready, let's go");
const itemData = $w("#dataset1").getCurrentItem();
console.log("ITEM-DATA: ", itemData);
if (itemData.copyOfCandidateResumeLink) {
$w("#button3").link = "mailto:"+ (itemData.copyOfCandidateResumeLink);
}
});
});
We will have to recode it!
But first, let us try to understand relationship between…
a) repeater
b) dataset
c) database
The DATASET is some kind of wire, which connects a repeater with a chosen databse. Only one database can be connected in same time.
So you have surely connected your database with the repeater using a dataset, in this case called → $w(“#dataset1”).
On the pic above we can see the results.
Your problem now is to get the related value out of the repeater, each time you click onto one of the buttons inside the repeater, to get the right selected data.
As already mentioned there are 2 different ways of how to achieve that!
- using CODE
- using DATASET-CONNECTION
See informatoin below (pic).
Delete your existing code and restart with the following one…
//----------------------------------------------------------------------------
//-------------------------PAGE-CODE------------------------------------------
//----------------------------------------------------------------------------
$w.onReady(()=> {console.log("Page is ready...");
$w("#dataset1").onReady(()=> {console.log("Dataset is ready...");
$w("#btnViewRemsume").onClick((event) => {console.log("View-Resume clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendEmail").onClick((event) => {console.log("Send-Email clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendText").onClick((event) => {console.log("Send-Text clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
});
});
OPEN THE CONSOLE, either inside Wix-Editor (on the very bottom of the screen), or in your local Browser (google-browser = F12 + console).
Do not forget to safe and publish your site first, if you want to use the console of your local browser.
Now do some actions inside your repeater.
Do you see some changes inside CONSOLE-PANEL ?
Now try to expand your code…
import {session} from 'wix-storage';
//----------------------------------------------------------------------------
//-------------------------PAGE-CODE------------------------------------------
//----------------------------------------------------------------------------
$w.onReady(()=> {console.log("Page is ready...");
$w("#dataset1").onReady(()=> {console.log("Dataset is ready...");
// SAVING DATA INTO WIX-STORAGE (MEMORY-FUNCTION)...
$w('#input1').onChange(event => {
session.setItem('value', $w('#input1').value);
});
$w("#btnViewRemsume").onClick((event) => {console.log("View-Resume clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendEmail").onClick((event) => {console.log("Send-Email clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendText").onClick((event) => {console.log("Send-Text clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
});
});
Adding more functionalities…
import {session} from 'wix-storage';
import wixWindow from 'wix-window';
//----------------------------------------------------------------------------
//-------------------------PAGE-CODE------------------------------------------
//----------------------------------------------------------------------------
$w.onReady(()=> {console.log("Page is ready...");
$w("#dataset1").onReady(()=> {console.log("Dataset is ready...");
// SAVING DATA INTO WIX-STORAGE (MEMORY-FUNCTION)...
//$w('#input1').onChange(event => {
// session.setItem('value', $w('#input1').value);
//});
$w("#btnViewRemsume").onClick((event) => {console.log("View-Resume clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendEmail").onClick((event) => {console.log("Send-Email clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendText").onClick((event) => {console.log("Send-Text clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
//------------------------------
$w("#btnCalendar").onClick((event) => {console.log("CALENDAR clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
});
$w("#btnSendText").onClick((event) => {console.log("Send-Text clicked!");
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
console.log("Clicked-Data: ", clickedItemData);
console.log("DO WE WANT TO OPEN LIGHBOX HERE SENDING THE CHOSEN DATA TO LIGHBOX????);
wixWindow.openLightbox("MyLightBox", {
"value1": $w('#pageSend1').value,
"value2": "My value2 to be sended to LB"
})
.then((data) => {console.log("DATA recieving back from LIGHBOX running...);
console.log("Returned-Data: ", data);
$w('#pageReceive1').text = data.lightBoxSend1;
$w('#pageReceive2').text = data.lightBoxSend2;
});
});
//------------------------------
});
});
Try to go trough all your code one more time and take a closer look onto it.
Notice all changes and check all element-IDs.