Power Table JTable Methods

This is more of a learning exercise for future use but lets say I wanted to use a JTable method on a Power Table. Below is the code that I thought would work but I’m missing some key concept here as to how Ignition is treating a component. This is setup on a Power Table property change script. “getGridColor()” and “getWidth()” work ok but it throws an exception at “getDropLocation()”. All 3 of these methods are part of a JTable according to JavaDocs.

if event.propertyName == "viewDataset":
	comTable = event.source
	print comTable.getWidth()
	print comTable.getGridColor()
	print comTable.getDropLocation()

Your table reference is getting the Power Table, not the underlying JTable. You can get the JTable using the following.

if event.propertyName == "viewDataset":
	comTable = event.source.getTable()
	print comTable.getWidth()
	print comTable.getGridColor()
	print comTable.getDropLocation()
1 Like

That makes sense now. Where does one find the documentation that shows the “.getTable()” method? I am unable to locate that in the Ignition documentation.

http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.11/com/inductiveautomation/factorypmi/application/components/VisionAdvancedTable.html

I’ve opined about this before on the forums, but the short version is that it’s unreasonable to document every property of every possible object you’ll be exposed to in scripting; take a look at that page; the VisionAdvancedTable java class behind the power table component has over a hundred methods; following the getTable() method to JideTable has a few hundred more, and isn’t even an “Ignition” component; it’s from a third party library.

I’d start with the further steps I outline here; it’s how I worked things out as a support rep:

I think that is exactly what I was looking for. A link to the JavaDocs on the Ignition code itself. I can then see the classes of the objects and go from there.

1 Like

Be aware that the JavaDocs are provided for use with the SDK, which has no support promises, or even API guarantees from version to version. They don’t form a “supported” interface for jython scripting that IA will maintain for your continued use. Very handy, but you may have extra testing to do when upgrading your Ignition installs.