I need to select multiple rows in a table and send the values to a label in another view.
I tried to use the checkbox column to select them, but I can only check one at a time. The selection mode is set to multiple interval.
What am I missing?
How are you setting the check box (for the single row)?
With the mode multiple interval you can select multiple rows using ctrl + click or shift + click (for a range)
We will use the system on phones and tablets as well. The shift + click or ctrl + click works fine on computers, but not on these touch devices.
I wondering to just touch the checkboxes to make multiple selections like ctrl + click.
i did scripting on onRowClick() event on the table
the table data needs to update to the database when the checkbox is selected.
Below is the checkbox column prop...I have created a view for checkbox coz by selecting render as boolean and boolean prop as checkbox, it should be clicked twice to select the checkbox
below is my code for checkbox column.... i tried passing vcheckbox=="true" also but getting error for both
vcheckbox=self.props.data[event.rowIndex].isselected
system.perspective.print(vcheckbox)
if vcheckbox==1:
system.perspective.print("checkbox:true")
else:
system.perspective.print("checkbox:false")
error is:
caused by org.python.core.PyException
Traceback (most recent call last):
File "<function:runAction>", line 31, in runAction
TypeError: 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset' object is unsubscriptable
if render selected as view then checkbox reflecting and if auto then blank
if checkbox selected then its value should be passed as 1 or true but I am getting output in console as blank
I need the selected property of checkbox which we can see in normal view but in table's column checkbox I am not getting that property so how can it be handled?
Seems you arent really understanding what is supposed to be happening here.
First of all how are you getting the data? How did you add in the column for isselected?
Are you passing the values down to the view? or is it just a checkbox? Because why arent you just using the boolean render.
Also you gotta set the value on row click, that was the whole point of not needing two clicks.
vcheckbox=self.props.data.getValueAt(event.rowIndex, "isselected")
self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, "isselected", not checkbox)
@victordcq ic query binding done to display the data in table and isselected is the column with null value getting from the table and I should pass 1 in isselected column and that entire row’s data to the table only if checkbox is selected else nothing/null/0…
basically I need to pass the row’s data only based on checkbox selection
should I do it on editcell commit ?but how can get the value of checkbox as true/1 or false/0
I want this property in table column of checkbox from where I can achieve it…
You could send a message when you press the check box but its really just gonna be easier to use the boolean render xd
no editcell required, we are handling the “edit” on row select because it requires one click less (for booleans)
this works for me for a simple dataset with boolean render. Ofc you gotte be sure the dataset isselected is set to boolean. and that the query isnt refreshing else it will overwrite the edits in the data prop
onrowclick event:
self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, "isselected", not self.props.data.getValueAt(event.rowIndex, "isselected"))
Isselected column value got changed by clicking row but it needs to be changed only when I tick the checkbox ..if I untick that checkbox again then null/0
Plz look at this below img: here under data prop they have boolean value for inactive and other 2 cols…the same way I want it for checkbox column …is it possible?
ahhh you can use onselectionchanged then. there you get
event.selectedRow and event.selectedColumn
you can then do an if on the event.selectedColumn to see if its a boolean column
and use the script but use event.selectedColumn instead of “isselected”
and selectedRow sintead of rowindex
heh for some reason this keeps getting triggered for me tho
I tried on oneditcellcommt as well but the difficulty is If i deselect the checkbox then also it is passing the value 1 in isselected column coz it is taking as edit committed…what can be done to fix it ?
is there any way to get only boolean value in isselected column like the below image where in data props they added isactive as boolean value
Then, I created an event onEditCellCommit with the script: if self.props.selection.data[0].Checkbox == True: self.props.data[self.props.selection.selectedRow].Checkbox = True
Finally, I set my button to get all the data from my table where the value on Checkbox column is True.
@augusto.junior@victordcq Thanks for your reply
I scripted on oneditcellcommit and it has printed the value as true/false in console when I select/deselect this was achieved by printing event.value and in scripting need to use 1/0 instead of true/false and from that value, I have given condition to pass the table row’s checkbox ticked data to database
checkbox=event.value
system.perspective.print(checkbox)
if checkbox==1:
system.perspective.print("true conditn")
else:
pass