How to get a selected object for setting visibility

0
Hello I built simple models like the below     and then I built a page like below     1. I set “Data source” by XPath in “List view”  - Test_Module.Book_Author/Test_Module.Book - [Status = 'Released'] 2. I set “Data source” by “Listen to widget” in “Data view” (It was marked by red line) - List view ‘listView1’   and then I want to set Visibility visible only when selected book object has “Normal” for level type but I can’t access the attribute of the selected book object  by using “based on expression” because $currentObject indicated Author object. So How can I get selected book object in this case? Thanks in advance  
asked
4 answers
2

Inside of the data view, the $currentObject variable (also referred to as the context object) will be the selected Book.

Try putting a container in the data view, and then putting the other input widgets inside of that container. Then, you should be able to set your desired conditional visibility expression on the container.

answered
0

Hi Minsoo,

If you have a data view listening to the list view then the $currentObject inside that data view should be Book. 

However the listener data view itself will only be inside the Author data view (which I assume is your page parameter, or outer view at least).

You should be able to put the three widgets in a container (Inside the listener data view) and then set the container visibility based on the $currentObject/Level.

Or you could set the visibility for each field individually if you don’t want to put them inside a container.

Kind Regards,

Josh

answered
0

@Josh Simmons

Thanks to respond my question

But you seemed to misunderstand my problem.

Here is my data structure.

The data view on top-right widget already has “Book, listens to widget ‘listView1’

But, the attribute for “visible” don’t have Book object as $currentObject

 

answered
0

Hi Minsoo,

Sorry if this has already been solved, but I have rebuilt your page locally and here is what I meant by the container inside the data view.

As you can see I made a container inside of the Book listener data view and then put the widgets inside it.
Because this container is inside the Book listener data view, it has the Book context instead of the Author context and you can set the visibility by level.

The Book listener data view itself is only inside the Author data view, and can’t use the context of the object that will go inside itself.

Kind regards,

Josh

answered