onEditCellCommit help

I have a table component with its data bound to a named query. I’m trying to enable the user to edit the content of certain cells. The appropriate column has props.columns[#].editable set to true but I’m struggling with the onEditCellCommit event. Everything I scripted resulted in errors so I decided to use the example from the manual and build up from there. However, even the example script from the manual is giving me an error. And now I’m stumped.

This is the script…

This is the error (2 screenshots)…

What am I missing?

M Murphy

To start, change the return format of your query binding to ‘JSON’ from ‘Dataset’ - that should clear up the error you’re getting.

1 Like

Well, that did it! I feel silly now. Thanks for your help @PGriffith!

Perspective has other syntax as vision for editing cells?


image

Substantially different. Did you look at the code above?

Yes, but i get the same error.


I thought that the solution is to use SQL language
In that case i don’t understand what they refer to use JSON form Dataset…
I have the table in the SQL data base…

I’m returning a dataset from a message handler script and I can display that on a table with no problem but if I try to use the ‘OnCellEditCommit’ Action I’m getting the same error as @mmurphy. I tried converting the dataset to JSON string and a Dict using a script, and the table that I write is empty now (for both cases) since it’s expecting a dataset for props.data.

Is there a way to have a script in ‘onEditCellCommit’ in my case? I just want to know which cell was edited and the new value. TIA

Cheers
Sam

step by Step :

Cells = > double-click "you can edit cells with double-click"
Colums => Field: add the name of your row
Configure your event => "write script" onEditCellCommit

got value changed : event.value
got id : using props selected row for example
at last : use query and do query="UPDATE NOMTABLE SET lib"+ Event.value+" WHERE ID="+STR(link to ur id)
use :system.db.runPrepUpdate(query)

That's not a valid use of runPrepQuery. Don't inject the id into the string as a string concatenation--use the question mark substitution and supply the id in the args list. Also, you are not validating the column name for the database in any way. That's not safe to concatenate.

1 Like

it works but I agree with you, i should correct it :slight_smile:
...
at last :
id = STR(link to ur id)
lib = Event.value
args=[ lib , id ]
use query and do query="UPDATE NameDATABASE.NameTABLE SET lib = ? WHERE ID= ? "
use :system.db.runPrepUpdate(query,args)