Image on selection in perspective table

I followed the instruction in https://docs.inductiveautomation.com/display/DOC81/Displaying+a+SubView+in+a+Table. There seems to be one thing missing: there is no instruction to set the subview parameters at rows.subview.viewParams in the table.

I set them to use selection.data[0] That seems to work, except when you click the expansion arrow it doesn’t set the selection. So if you don’t click on the row before you click on its expansion arrow, it shows the map from the previous (which is still the current) row selection.

Did I miss something in the instructions? Or is there something else that tells what the row contents are on the expanded row instead of the selected row?

Thanks

You're right, and conveniently enough, you don't need to.

The tooltip on the rows.subview.viewParams property alludes to "implicit params". Each row in the table is implicitly passing information about the row to the subview. There's a couple of different built-in things like row count and values for each column.

So if you configure the view params on the to-be subview exactly like you see in step 6d of the "Create a View for Displaying the Map" section (an object named "value", with values that have keys matching the names on the columns you want to pass to the subview), the table will automatically pass the contents of the named keys to the subview as view params.

2 Likes

OK, I gotcha. I didn’t have the input parameters set up as object named key instead of value. It works fine once I fixed that. Thanks!

2 Likes

Thanks Paul. I found that to be unclear in the documentation as well.

And thanks again Paul. I had to come back here to refresh my memory. Thick skull I suppose.

The key part for me is the note on 6d:

Note: It's important that the object here is named "value". The perspective table we're going to embed the map into has a feature where content from each row in the table can be passed to its subview. This mechanism requires that the subview contain an object named "value". In So if you wanted the subview to be passed any of the values from it's parent row, simply make a "value" object, and add values to it where the keys match the name of the column on the table.

Thanks!