I have a table with two columns that are editable, a boolean and a string. I set the onCellEdit field to “single-click” however the real functionality seems to be click once to select the row, then click again to check the boolean or start writing to the text column. Is there a way to make it truly be like a work on a single click? I tried to use the onFocus and onRowclick but nether tell me what column was clicked, which would be enough for me to then programatically just select the box. Any one have a workaround on this?
Bump this question, I’m seeing the same thing. For a table with bool (checkboxes), how can we make it where we can click a single time to check or uncheck, not click to select, then click to check or uncheck.
I had the same problem some time back and didn’t solve it. I understand a bit more now, had a quick look and this seems to work:
Configure an onRowClick event action on the table. Add a script. My checkbox view column is chk
.
if self.props.selection.selectedColumn == 'chk':
self.props.data[event.row].chk = not self.props.data[event.row].chk
On the Checkbox subview I’ve added params
"value": {
"chk": false
}
and bound the checkbox to view.params.value.chk
.
I can now single-click anywhere in the table cell and toggle the checkbox.
I recently encountered this and this post plus a call to IA support helped me solve it. I just wanted a table that had one column of checkboxes and another with the name.
We just used the contents of that if statement (not the actual if statement though) in the onRowClick event:
self.props.data[event.row].chk = not self.props.data[event.row].chk
Then, it was an issue with the "cells --> allowEditOn" property of table. I had it set to "single-click", but that was triggering the checkbox twice when I clicked specifically the check box itself. We then changed it to "double-click". Now it works as expected (any single click in that row toggles the checkbox)!
Thanks for the help!
(Also, this is my first fourm post, so sorry about any formatting issues).
this works
if self.props.selection.data[0].checkBox == 0:
self.props.data = system.dataset.setValue(self.props.data,event['row'],'checkBox', 1)
else:
self.props.data = system.dataset.setValue(self.props.data,event['row'],'checkBox', 0)
You can just use:
self.props.data = system.dataset.setValue(
self.props.data,
event['row'],
'checkBox',
not self.props.selection.data[0].checkBox
)
In my case I wanted to only toggle the checkbox if the checkbox column was clicked. Column selected isn't in the row click event, but I think this is a workaround
if col == 'Selected':
row = event['row']
self.props.data[row]['Selected'] = not self.props.data[row]['Selected']
EDIT: Make sure to use event['row']
not event['rowIndex']
. event['row']
reflects the state of the row regardless of filtering/sorting
I know that the only options for allowEditOn are double-click, single-click, and long-press, but is there a way that I could allow editing on a keypress or with a script? I have operators entering data into 70 cells consecutively, all of which are in the same column. They've said that clicking on the cell isn't user friendly enough for them and would like for the onCellCommit event handler to automatically advance them to the next cell and prime the cell for editing. Advancing the cell is something that I can do, but not the auto-edit. Some JS injection hack, maybe?
Worst case, I could have one text entry field outside of the table where they enter data and have it write to props.data source data table and refresh the perspective table.