I'm trying to select the current item from a repeater without success!

I am trying to build Service Pages that consist of a Service Repeater, a Details Repeater, a Slot Repeater, and a custom booking form on light box. I have also created a “Thank you” page to send my clients to upon a successful booking. The light box with the booking form is on a separate page. There are a total of 3 pages involved.

All of the repeaters are on the main page. The Details Repeater and the Slot Repeater are hidden until a button click function unhides them one at a time. Here is the problem; When I select a service in the Service Repeater by clicking the “More Info” button, the Service Repeater becomes hidden and the Details Repeater becomes unhidden, just I had planned, however all of my services show up on the Details Repeater instead of just the one I selected. I have no idea what I am doing wrong. I have copied and pasted code from everywhere I could find it. Could someone please show me an example of a code that will actually make just the selected item carry over to the other repeaters? After a month, I am ready to throw in the towel!

Admittedly, I am not very good at coding. I have reached out to Wix Support a few times and they keep sending me a link to “Create a Custom Booking Page.” I have tried every example there!

I feel really stupid for not being able to figure this out, but I need help. PLEASE, I’M BEGGING!

May be try someone who can write it for you and pay to them.

I am with you only I have 8 years experience in web development(ASP.NET C##). It is either because I left IT 10 years ago or may be because WIX code is nothing like I have done before I have given up on many good ideas for my company website on Wix because it takes a lot of time to do a simple task and there is always something missing in their controls.

It has taken me about 3 hours today to do for a five lines of code to figure out how to control IFrame. Now I am stuck with a couple of extra features I want to add and I have come here for help. I can imaging how it is hard for you to work with Repeaters.

Realize that copy and pasting is not really the best way to code. You need to understand what’s going on and why in order to accomplish your goals. Wix Code isn’t all that difficult.

You can find a wide assortment of examples in these location:

Please help me. The page is still named “New Page.” This is the editor URL:
https://editor.wix.com/html/editor/web/renderer/edit/6311f98e-c6a7-48b8-95d0-cbb722399852?metaSiteId=929fe1fa-429c-422f-8460-a8be6fd1dc52&editorSessionId=c28c55a6-3160-4378-8ab6-6b928cd088d6&referralInfo=my-account

I tried this:

$w.onReady( function () {
$w(‘#Classrepeatercontainer’).onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item(‘#Servicesdataset’).getCurrentItem();
} );

But it didn’t work. I tried combining the button click event with the onclick event and that didn’t work either.

export function MoreInfo_click(event) {
$w(‘#Classrepeater’).hide();
$w(‘#ServiceDetailsrepeater’).show();
let $item = $w.at(event.context);
let clickedItemData = $item(‘#Servicesdataset’).getCurrentItem();

My site won’t save. I keep getting “Error Code 1020” when I try to save. There are over 1000 errors in the console and don’t even know where to begin the debugging process. I have paid for my Wix Site or the entire year. I’m in a panic and I just don’t know what to do right now. I’m sorry.

@thebarkacademy Some observations:

Why are you showing the details in a Repeater? A repeater is for showing a list of items. If you want to display a selected item from a Repeater, then you should either use a dynamic page, a $w.Box , or a Lightbox .

In the MoreInfo_click() event handler, you don’t do anything with the selected item. Well, you do, but you don’t. You get the current item:
let clickedItemData = $item(‘#Servicesdataset’).getCurrentItem();
But then you don’t do anything with it.

As an example of how to handle a selection from a Repeater, see the Ratings example . I mostly wrote this example to demonstrate the ratings components, but it also demonstrates a simple Repeater/selection/details mechanism which. Take a look and I’ll be happy to answer questions.

I also didn’t see the container1_click() function that you set for the container. I guess since the function doesn’t exist, it’s just ignored when the item is clicked.

@yisrael-wix I was able to view the Ratings live page, but I receive “page not found” when trying to view the template. I like how the popup seemed to hover over the main page. Was that a light box?
The reason I am using repeaters is because I didn’t want my website user to have to wait on multiple pages to load. I also like how the booking widget opens in multiple viewing panes. I think I am trying to simulate the widget, but with more of my style added to it.

@yisrael-wix Hi Yisrael, would you mind taking a look at my page again? I am still not able to get the current item to display and when I look at the page in preview mode with “Verbose” on, it appears to be calling and returning a current item, but it always returns the first one displayed. However, an earlier code ($item.scoped) that I had entered and deleted (I thought) is selecting the right item. Also, I have my booking form in a lightbox. Every time I try to work on the lightbox to get it functioning, my site stops saving.

I will really appreciate any assistance you can provide and I am so excited about what the future brings with Wix!

@thebarkacademy You wrote:
“The reason I am using repeaters is because I didn’t want my website user to have to wait on multiple pages to load.”

However:

  • loading a website doesn’t wait for multiple pages to load. Each page has its own load process.

  • A repeater is designed for repeating. If you want to display information for just one item, then it would make more sense to use a $w.Box , or a Lightbox .

  • And, dynamic pages are really much better suited to this sort of scenario.
    In order to get the current item from a Repeater, you must use the $item context sector as explained in the API documentation.

@thebarkacademy Some other points:

  • What page are you referring to?

  • Also, I don’t see any Lightboxes on your site.

  • The Ratings template opens fine for me.

@yisrael-wix Hi! Here is the editor URL: https://editor.wix.com/html/editor/web/renderer/edit/6311f98e-c6a7-48b8-95d0-cbb722399852?metaSiteId=929fe1fa-429c-422f-8460-a8be6fd1dc52&editorSessionId=97718817-28e6-475d-8090-bc4f36379747&referralInfo=my-account

I still haven’t given the page it’s permanent name so it is the “New Page.”

I have been studying Wix Code from every source I can find! I think I have too much co-mingling of coding going on my brain, LOL. But, I seriously can’t wait for whatever Wix comes up with next!

I haven’t finished coding the page, yet. I still have to query my database to set my available slot table. Could that be the cause of the selected item not properly displaying in the next box? Maybe, I haven’t properly closed the page script (just a thought).

What I meant when I said I didn’t want my site visitors to wait on multiple page loads was being sent to multiple pages on my site, and almost all of the custom booking examples have multiple repeaters. I just assumed I had to use them.

I deleted the lightbox. I believe the problem was with one of the user input fields, but every time I tried to edit it, it refused to save and would go right back to how it was before I edited it.

@thebarkacademy You have one Repeater overlaid over another, overlaid over another… I really can’t figure out what’s going on.

You have several More Info buttons that are in different Repeaters, and you only have one MoreInfo_mouseout() function. The $item context selector indicates which MoreInfo button, but I have no idea how it will correspond to the Dataset.

I can only again suggest that you take a look at the Ratings example to see how to select an item in a Repeater. It will be a much cleaner design, and the code will be clearer, if you use dynamic pages for the repeater selection. You can also use a Lightbox, but dynamic pages are easier as they have the necessary mechanism built in.

@yisrael-wix I will try the Dynamic pages. But, except for a little fine tuning, my page looks just the way I imagined! It’s awesome!

I tried again to look at the Ratings template found here: https://editor.wix.com/html/editor/web/renderer/edit/bdcbbbc1-6c39-44fc-99cb-f62053fba787?metaSiteId=44408a2e-69fd-4460-93fc-38c3899f2b0c&editorSessionId=b428064d-9309-5f61-8996-48c4d403c212 (see below)

It still won’t load. The main page and the live site does, but not the template.