I have a table with a binding on data, I am working on using the table as a sort of navigation for another view on the page so when you click on a specific row, that row’s data is passed to a subview.
the issue im having comes into play when unselecting a row..I made a clear button to write the default values to props.selection but that isnt working. Ive tried using -1s, None, and even imported JsonNull. i see the selection values change, both in designer and on a webpage (put a label with that prop on the view) but the table itself isnt rendering out the selected line background color.
i tried doing a refresh binding on the data,
i even tried disabling the selection.enableRowSelection and then re enabling it in the clear button script and that didnt work either.. am i missing something?
the only other issue i can think of is that i have errors on the data property because i have spaces in my dictionary keys… but i dont want to rework…
Only the table component in the browser can effectively do this. You have to disable row selection in one script, then use a change script on selected row to detect when the browser has reacted to that, and turn row selection back on. It is important to not turn off row selection if the selected row is already None.
Do not write directly to the selected row property.
With the exception of the selection data property, the selection properties are bidirectional, meaning that if you were to change the value of the selected column property, it should be reflected in the table component.
Try writing None to both selectedRowandselectedColumn (even if you have enableColumnSelection off...).
In reality, I use this method often, havent experienced any issues with my (documented) approach.
What issues have you observed? Have you reported these bugs to IA?
@pturmel where do i put the enableRowSelection to false script? tried it on the clear button, didnt work with a change script on selection.enableRowSelection to set back to true when false.
In my projects, I regularly add a message handler to each table component. From Configure Scripts on a component, I add a Message Handler named "clearSelection" (or named according to a group when multiple tables of a view are involved). The (Page) message handler has the following script:
def onMessageReceived(self, payload):
# Set both selected row/column properties to initial values:
self.props.selection.selectedColumn = None
self.props.selection.selectedRow = None
Then, within a button (or any other component property binding / event script, etc.):
# Preset selection of other tables:
system.perspective.sendMessage(messageType="clearSelection") # Default scope = Send to components in current Page
This method has been reliable for me. Background color in client UI and selection.data update as expected.