On a Google appmaker table
, I have a label
that I only want visible
when the row is active/selected by the user.
I can see that the datasource.itemtIndex
would give me the current index that my label is at (I presume it's not the selected index), but I can not seem to find a property that shows me the currently selected index/row.
Bind the visibility of the label like this ==>
@widget.datasource.item._key === @datasources.<DatasourceName>.item._key
Just make sure to change <DatasourceName>
with whatever datasource you're using.
Try adding this style
visibleOnAncestorHover
to the label styles. This should make it visible both on hover and when selected. (This is used by default on Table widget's row delete buttons, I think.)
EDIT: and remember to have the 'visible' setting on for the label.
The only way I found to do this is to set the visible binding on your label, of course you would want to set your visibility type to absent (will mis-align your table rows to labels) or hidden (will just hide the label). This solution is different from the 'visibleOnAncestorHover' as the label will still be hidden on other rows when you hover on those rows, it is only visible when the row is actually selected. The only binding that seems to work is this:
@datasources.YourDatasource.itemIndex === @widget.parent.childIndex
The following apparently does NOT work:
@datasource.itemIndex === @widget.parent.childIndex
or
@widget.datasource.itemIndex === @widget.parent.childIndex
You can specify this in the style editor:
.app-NewPage-Table1Row:not(.selected) .app-NewPage-Field2 {
visibility: hidden;
}
来源:https://stackoverflow.com/questions/45830273/google-appmaker-selectedrow