Perspective Table Re-render view

Is there a way to refresh a rendered view in a perspective table? I added a delete row button to remove data from a dataset, and tried using a message handler to refresh bindings on the table and the rendered view but the rendered view still doesn’t show data correctly. When I hit stop in the designer, then the views re-render correctly, and the table looks fine.

https://docs.inductiveautomation.com/display/DOC80/Perspective+Component+Methods#PerspectiveComponentMethods-RefreshingBindings

@jlandwerlen I am using the refreshbinding method, but it doesn’t seem to be working.

ive sued the refresh binding before, it should work.
Can you show us how you used it?

@victordcq I have a table that has a delete button in the last column:

The delete button which is in a rendered view has the following code in the onActionPerformed event:

messageType = ‘deleteRow’
payload = {‘rowIndex’:self.view.params.rowIndex}
system.perspective.sendMessage(messageType,payload,scope = ‘page’)

The deleteRow message is then ran on the table component in the main view. Here is the code:

if len(system.dataset.toPyDataSet(self.custom.userDataSet)) > 1:
	rowToDelete = payload['rowIndex']
	self.custom.userDataSet = system.dataset.deleteRow(self.custom.userDataSet,rowToDelete)
	self.refreshBinding("props.data")
else:
	pass

messageType = 'refreshView'
system.perspective.sendMessage(messageType,scope = 'page')

The refreshView message is then run on the dropDown rendered view and the numericEntry rendered view. I have separate messages for these separate views (maybe this is part of the problem):

self.refreshBinding(‘props.placeholder.text’)
self.refreshBinding(‘props.placeholder.color’)
system.perspective.print(‘refreshView Message Handler Ran on dropdown’)

messageType = ‘updateUserDataSet’
payload = {‘cellValue’:self.props.value,‘rowIndex’:self.view.params.rowIndex,‘columnName’:self.view.params.columnName}
system.perspective.sendMessage(messageType,payload,scope = ‘page’)

I don’t know if this is enough context to make sense, but let me know if you need more context.

i dont fully undestand this bit, but i dont think its to important.

Now for the main code, is your props.data bound to custom.userDataSet ? i’d guess so since it works on refresh but maybe something happends over there?

Do you see the custom.userDataSet lose a row when you press delete?
Eventho the table doesnt lose it (yet)

Unrelated, but in case you didn’t know, you can pull those numbers off the left border by adding a paddingLeft to your styles eg set to 5px

1 Like

In order to get this to work, I had to reach out to IA. We determined that the value of the dropDown was causing the issue. We had to bind the props.value of the dropDown to the props.placeholder.text. Once we did this, it works perfectly. The issue was that the dropDown view was holding the props.value that was selected when a selection was made.