How to disable edit mode on a Perspective Table Cell

Hello All,

I have a Perspective Table and I have enabled Column and Row selection on it. I have also made some of the columns editable. But in these columns, I only want a couple of the rows to be editable. I am using the onEditCellStart event to try to cancel the action before it starts. The code is not throwing errors and the cell remains in edit mode. I have tried to make the selectedRow and selectedColumn = -1. I have also tried making them null. I can see in the Designer that the selection goes away but the cell is still in edit mode. I have also tried programmatically pressing and releasing the Esc key using java.awt.Robot and java.awt.event.KeyEvent. Another thing that I have unsuccessfully tried is using the onRowDoubleClick event. Can someone please help me take the selected Table Cell out of Edit mode?

Best regards

what if you leave the cells editable, but onEditCellCommit add a script to check whether the row of the cell being edited is one of the rows you want to allow to be edited? In other words, they can change the value of the cell all they want, but when they commit the value, if it isn’t in a row that can be edited, it’ll just revert to the previous cell value.

I may be misunderstanding your question, but that is the first thought I had

1 Like

Thank you for responding @YF129701. I’d like avoid confusion by not letting the user change the cell contents on those rows. Do you have any other ideas on how I can make this work?

Each individual data element can be given an editable attribute in the JSON; that will be used over the column’s editable setting if specified.

image

3 Likes

Also, this will never work. Perspective is running in a 'real' browser session - only Javascript code is running. The Python code you write in extension functions is running on the gateway.

Thank you @PGriffith. This is closer to what I want to do. The only thing is that the data is not hard-coded, it comes from a bound SQL Named Query. How can I set the editable property on these rows?

Set the named query to return as JSON, then add a script transform that manipulates the data to add the editable key as needed.