I have a table with Locations. Let’s call the Locations, x, y, z.
If I Configure events on the table with a onRowDoubleClick, and add the following code, I am able to print the Location (x, y, or z) when I double click on a table row.
I have a TimeSeriesChart that has a named query of “Last30Days” bound to series[0].data, which named query accepts a parameter named “plant”. I want the TimeSeriesChart to update when I double click on the table.
When I try the following code in the onRowDoubleClick of the table (see section labeled #CODE#), I get an error (see section labeled #ERROR#). Why the error?
For posting code and errors there is a Pre-Formated text button it looks like </> or you can use three back ticks ``` before and after the code, that will make your code much easier to read. Not really a big issue here but, as the code gets longer with deeper indentation it will be.
This:
self.getSibling('TimeSeriesChart')
is returning a NoneType, this means either your TimeSeriesChart is not a sibling of the table, or self is not what you think it is.
I’m pretty confident that self is really the Table Component, which means that ‘TimeSeriesChart’ is not the name of a sibling of the table. Are they actually in the same container?
I have attached a screenshot of my container. The TimeSeriesChart is in root as well as the Table.
If I double click on the Table, and insert the following code in the onRowDoubleClick action of the table, you can see the output in the TextField on the attached screenshot.
Okay, putting the getSibling thing aside, I didn’t notice in your original post that you are trying to write to a property which is bound. Even were the error not present this wouldn’t work as the binding would write over the data with whatever it returned.
Instead you should create a custom property somewhere, perhaps the chart, and then bind that custom property to the selection data. You can then use a script transform to pull the location out of the selection.
Then in the binding, bind the parameter to the custom property. Whenever you change the selection on the table the chart will update automatically.
Of course if you want to stick with the double click you can just write to the custom property from the script, though that will bring us back around to why you’re getting the error with the getSibling function.
I understand the Custom Property option and have successfully used it in other projects. However, the runNamedQuery option will inevitably come up when no parameters are in play in this project. I specifically need help in resolving this runNamedQuery issue.
This isn’t a runNamedQuery issue. The error you are getting states 'NoneType' object has no attribute 'props'. The only way this is true is if self.getSibling() returns None. Somehow, self has no sibling named TimeSeriesChart.
I don’t know why that is in this case, I created a blank view with a TimeSeriesChart and a table, configured the onRowDoubleClick event and was able to grab the props.
After removing the binding on TimeSeriesChart, the error no longer occurs. Your earlier post helped me understand I did not need the named query binding together with running the named query in the action. Removing the binding from TimeSeriesChart also eliminated the error. Thanks.