Display selected element data in a modal form a collection list

hi, I’m try to display the selected element from a collection list,
is it possible to pass the array index to the modal and get it from the collection?
or i can save the element in a custom variable and then use it, what is the best practice in weweb

also i can’t see the elements inside a modal in the navigator, i don’t know if it’s a bug or is somewhere else

thanks

1 Like

Yes, you can utilize the array index in the modal.

  1. create a variable called selected_item
  2. create a workflow on the item that you want to click on to open the modal
  3. as an action item in the workflow, change the selected_item variable to the index
  4. in the modal, use the selected_index variable to filter your collection

On modals, you should be able to click on the section element in your navigator pane, and then under Specifics, it should show “Force Display in Editor”. This will allow you to view the modal even if its hidden for the UI.

You should definitely be able to see the elements in the navigator in tree view. If not, you may want to delete your modal, and add a new one.

2 Likes

Thanks Kevin, but I can’t see the force display in editor, do you have a screenshot?

when i select elements outside the modal they automatically appear in the navigator in the left
when i select elements inside the modal nothing happens

thanks

Screen Shot 2022-06-13 at 5.52.16 PM

You must select the whole section in the navigation pane to see that.

I think you may need to delete and re add your modal. I’m wondering if something got shifted or an error is causing it not to display in the tree view for elements.

thanks but i can’t see it :thinking:
i recorded a video maybe is more clear

Ah ok, I see!

The Open popup Element is an old element with poor UX. We have plans to update it but, in the meantime, we recommend using toast or modals.

To force the display of a modal or toast, you’ll need to select the section in the Navigator and force the display in the settings as Kevin mentioned:

Does that help?

2 Likes

Thanks Joyce, yes now is working :+1:t3:

1 Like

Hey @kevinwasie I’m a noob - when I create the variable “selected_item” it’s asking me for a type. Do I select Array? If so, what do I define as the initial value? And in the workflow, how exactly do I “change the selected_item variable to the index” ? And in your point #4, did you mean to say “selected_item variable”? And finally, what element do I apply my “select Item and open modal” workflow to? the entire collection list element? to the collection item inside that list? Thanks.

Hi @fredo22 :wave:

You have a collection list and want to display the information from a selected item in the list in a modal, is that correct?

If so, I think the first method explained in this video might help: WeWeb Academy

Instead of binding the variable data to items on a new page, you can bind it to items in a modal.

Does that make sense?