# Project Listing via CMS in a lightbox

**URL:** <https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216>\
**Category:** Ask the community\
**Tags:** code, cms, question, wix-studio\
**Created:** [July 28, 2024, 10:04am UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216 "2024-07-28T10:04:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divyesh\_Bhandari](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/divyesh_bhandari/32/83285_2.png) [@Divyesh\_Bhandari](https://forum.wixstudio.com/u/Divyesh_Bhandari)\
**Post date:** [July 28, 2024, 10:04am UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/1 "2024-07-28T10:04:35Z")

</div>

**Question:**  
Using CMS for Project Listing via dynamic page and want to show detail about each Project using LightBox.

**Product:**  
Wix Studio

**What are you trying to achieve:**  
I am creating a dynamic project page. Via CMS. Listing is working. I am using repeater to list them all. Each item has a button to “Learn more” about the project, which I am trying to showcase via Lightbox.

**What have you already tried:**

- I came across this workaround - [CMS Request: Dynamic Popups | Help Center | Wix.com](https://support.wix.com/en/article/cms-request-dynamic-lightboxes?tabs=Wix-Editor)

**Additional information:**  
Getting this bug.  
windowSdkFactory.ts:  
144 Uncaught (in promise)  
Error: There is no lightbox with the title “#lightboxMEP”.  
at Object.openLightbox (windowSdkFactory.ts:144:10)  
openLightbox @ windowSdkFactory.ts:144

- 

Really appreciate any help on this.

---

<div class="post-metadata">

**Author:** ![DeanAyalon](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/deanayalon/32/94633_2.png) [@DeanAyalon](https://forum.wixstudio.com/u/DeanAyalon)\
**Post date:** [July 28, 2024, 10:34am UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/2 "2024-07-28T10:34:06Z")

</div>

There’s no need for dynamic lightboxes, at least not for your use case

Using code, you can pass data to your lightbox:

Page code

```js
import wixWindow from 'wix-window-frontend'

learnMore_click() {
    // Opens lightboxName passing #dynamicDataset's current item as context
    wixWindow.openLightbox('lightboxName', $w('#dynamicDataset').getCurrentItem())
}

```

Lightbox Code

```js
import wixWindow from 'wix-window-frontend'

const data = wixWindow.lightbox.getContext()

```

---

<div class="post-metadata">

**Author:** ![DeanAyalon](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/deanayalon/32/94633_2.png) [@DeanAyalon](https://forum.wixstudio.com/u/DeanAyalon)\
**Post date:** [July 28, 2024, 10:35am UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/3 "2024-07-28T10:35:23Z")

</div>

After getting the lightbox context data, you can choose two courses of action:

1. Use a dataset and set its filter to the item’s ID
  - **Pros:** Adding new elements requires simply linking them to the dataset
  - **Cons:** Fetches the data again once the lightbox loads, which makes loading time a tad longer

```js
$w('#dataset').setFilter(wixData.Filter().eq('_id', data._id))

```

1. Set element data using code
  - **Pros:** Faster loading time, endless customizability
  - **Cons:** Requires modifications to the code for each element, pretty simple code, but still

```js
$w('#title').text = data.title // example #title element

```

---

<div class="post-metadata">

**Author:** ![Divyesh\_Bhandari](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/divyesh_bhandari/32/83285_2.png) [@Divyesh\_Bhandari](https://forum.wixstudio.com/u/Divyesh_Bhandari)\
**Post date:** [July 28, 2024, 12:59pm UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/4 "2024-07-28T12:59:30Z")

</div>

Thank you for your prompt response.

Below is the code that worked. with your suggested direction.

On dynamic page:

```javascript
import wixWindow from 'wix-window-frontend';
export function learnMore_click(event) {
$w('#dynamicDatasetMEP').getCurrentItem());
let $item = $w.at(event.context);
wixWindow.openLightbox('Project Details', $item("#dynamicDatasetMEP").getCurrentItem());
}

```

On LightBox Page (no need to connect any field to CMS)

```javascript
import wixWindow from 'wix-window-frontend'
$w.onReady(function () {
const data = wixWindow.lightbox.getContext()
$w('#projectname').text = data.title;
//.....REST OF THE FIELDS
});

```

Thanks again.

---

<div class="post-metadata">

**Author:** ![DeanAyalon](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/deanayalon/32/94633_2.png) [@DeanAyalon](https://forum.wixstudio.com/u/DeanAyalon)\
**Post date:** [July 28, 2024, 5:41pm UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/5 "2024-07-28T17:41:24Z")

</div>

Is there a particular reason you’re using $item instead of $w? I believe $item is used for a different purpose and is redundant here

Also, glad to help 🙂

---

<div class="post-metadata">

**Author:** ![Ella\_Yehudai](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ella_yehudai/32/82227_2.png) [@Ella\_Yehudai](https://forum.wixstudio.com/u/Ella_Yehudai)\
**Post date:** [September 14, 2024, 11:30am UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/6 "2024-09-14T11:30:33Z")

</div>

Can you please explain which information should be in each please in the code?  
for example, ‘Project Details’ is the ID of the lightbox? Thank you!

---

<div class="post-metadata">

**Author:** ![Divyesh\_Bhandari](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/divyesh_bhandari/32/83285_2.png) [@Divyesh\_Bhandari](https://forum.wixstudio.com/u/Divyesh_Bhandari)\
**Post date:** [September 14, 2024, 6:32pm UTC](https://forum.wixstudio.com/t/project-listing-via-cms-in-a-lightbox/61216/7 "2024-09-14T18:32:45Z")

</div>

The first piece of code should go in your listing page. Which in my case I called the data via CMS.

The ‘Project Details’ is a lightbox page which I later called via click function when one of the item is click from the list.

The second piece of code goes in the LightBox page (Project Details).  
where I bind which information from CMS with different form field.
