Editing Perspective table with allowEditOn single-click still takes two clicks

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?

1 Like

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.

3 Likes

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.
Checkbox single-click

I can now single-click anywhere in the table cell and toggle the checkbox.

8 Likes

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).

4 Likes

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
	)
1 Like

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