Table toggle switch

Hi,
New to Ignition and using Ignition maker. In the designer I have placed a table with 3 columns. Two columns have boolean tags and I want to use the toogle switch. The table is showing toggles and in correct state according to the boolean tags. However I can't manipulate them although the binding is "bidirectional". I can double click and select the cell and manipulate it but it won't save. I have created a single toggle switch on the same tag and it's working so must be doing something wrong with the table settings

Did you implement the "onCellEdited" event on the table?

Toggling the switches of the table is manipulating the (local) data of the Table, but it does not write-back to the (remote) data from the binding. The preceding example should work if there is a bidirectional binding in place on Table.props.data. If there is not, then the code would only temporarily replace the data local to the table, and would not write back to the remote data.

I can't find that on the table event. I have right clicked in the table and then events.
I have ignition maker so having Ignition designer and Perspective components if that makes any diffrent?

The onCellEdited example is Vision, so it won't be applicable to perspective.

As noted by @cmallonee, this is what you need:

If that isn't enough, perhaps show us your table, scripting, and prop settings, so we can dig deeper into the problem

Here are a couple of other things you can check:
Column prop set to editable:
image

Update script correct in onEditCellCommit event script:

def runAction(self, event):
	self.props.data  = system.dataset.setValue(self.props.data, event.row, event.column, event.value)

I have tried all of the solutions above but with no luck.


Hi @Tim_Hansson,

This worked for me.

Here you can find a export of the view with a test table.
test_2022-10-10_2141.zip (4.9 KB)

Regards

Arnaud

That did the trick, thanks!

1 Like

Just as a note. As mentioned, if you have a binding on your data property to load data from some other source, then this will only temporarily modify the data (until the binding refreshes). You need to insure that you are modifying the source of the data with the new values, then let the binding update the data property. This can be done with either a bi-directional binding or with a scripting method such as system.db.runNamedQuery()

If the table is the source of the data, then you're fine, if it isn't eventually you will loose your changes.

2 Likes

Hi, I have a new problem with this. I've added the table to a tab container. And now it doesn't work anymore as before?

can you send a little be more info, view structure, scripts, print screen.

I copied the table in the tab, to outside of the tab, and now that doesn't work either :confused:

I just try and I cannot reproduce this error on ignition 8.1.21

Thanks, then I'll try to find the problem elsewhere