Perspective - Refresh Custom Property Binding

I have a custom property “settings” on my main dashboard view. It is bound to a named query that retrieves a set of ranges/parameters. In the dashboard, I have multiple instances of views with input parameters bound to individual values from my “settings” dataset.

I’ve added a popup view that allows the user to update the parameter data source. Once that update is complete, I send a message “refreshParameters” from the popup. In my main view, I have a message handler configured. In that message handler configuration, I want to force my “settings” custom property to refresh. So far I have tried using the .refreshBinding as well as simply calling the stored procedure again and replacing the “settings” dataset. Neither appear to be working. Any ideas?

pathtocompoent.refreshBinding(custom.prop) should do

In the Message Handler (and assuming the Handler is on the component which has the custom property):

self.refreshBinding("custom.settings")
2 Likes

I have my custom parameters at the view level, and my message handler is at the ‘canvas’ level below that. Do I need to define my parameters at the slightly lower level?
image

self.view.refreshBinding("custom.settings")

I was unable to get the refreshBinding syntax to work.

I changed my custom property “settings”; I removed the binding, made it persistent, and then populated via an onStartup at the view label. I then updated my message handler to set “settings” via a runNamedQuery, and that appears to be working.

In the image above, I have an “Update Parameters” popup that fires a stored procedure on the OnEditCellCommit event, and then sends the “refreshParameters” message. To validate, I added a table and a label to my display; the table is bound directly to the “settings” property, and the label is bound to a derived value from settings. These derived settings are custom properties created with an expression+script binding. (Looping through the “settings” basic dataset and getting the value for the parameter name).

What I’m seeing is that the table updates appropriately now, but the label does not reflect the changed “settings” value. Unfortunately all of my view instances (inside repeaters) have parameter inputs bound to other instances of the derived values, and those are not changing either.

Can you provide some guidance on what I should be doing in order to have my custom property changes propagate all the way down into my view instances?

I would need better insight into how you set everything up (perhaps you could supply the view.json file?). It’s important to note that you will see no change to the binding if the PARAMETERS of the query have not changed. So make sure that the values the query uses have actually changed, otherwise your attempt at refreshing the binding is just going to get the same data.

I think I figured out what is causing the issue.

At the top level of the view, I have a custom property “settings” that is bound to a named query. I had a second custom property (same level) defined called “range” that is bound to an expression+script transform. The expression part was a string, and then the script took that string and looked up a value from the “settings” property. The “range” property would never update, not even through a refreshBinding nor a change to the “settings” variable.

To test my hypothesis that this was propagation related, I switched my expression and scripting in the “range” property; I bound it to the “settings” property and then added a script transform to extract what I needed. This worked immediately. I assume that in the first scenario the “range” property is not getting marked for propagation since the reference to “settings” is in a transform.