Executing code after editing of one cell in datagrid is done

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
vladoportos
Posts: 17
Joined: Wed Jun 20, 2012 8:21 pm

Executing code after editing of one cell in datagrid is done

Post by vladoportos » Wed Jun 20, 2012 8:27 pm

Hello All,

I have small application that I learn the LiveCode on and I'm stuck on one thing for now.

I want to execute function after a datagrid cell is edited ( automatic so there doesnt have to be save button to press ) that would update SQLitle DB with data from datagrid..

I have the part where it determine the line selected, break to array and extract values, but I was looking through the custom Column Behavior but I can't find proper handle

there is
on FillInData pData but this doesn't work so far :-/

Any idea how to approach this ?

Thanks,
Vladimir

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10356
Joined: Wed May 06, 2009 2:28 pm

Re: Executing code after editing of one cell in datagrid is

Post by dunbarx » Thu Jun 21, 2012 4:28 am

Hi.

I am not sure what you really are asking, but does this help? (from the dg manual, p228)

EditValue

- EditValue pKey - The EditValue message is sent to a table column control when EditCell or EditCellOfIndex is called. In this scenario there is no pKey parameter since the key is the column associated with the column control the message was sent to. Tip: use the dgColumn property of a column template to get the name of a column in the column control.

The EditValue message is sent to a row when EditKey or EditKeyOfIndex is called. In this case the first parameter is the name of the key in dgData that should be edited. Normally you will call EditFieldText from within the EditValue message in order to open a field editor for changing the contents.

vladoportos
Posts: 17
Joined: Wed Jun 20, 2012 8:21 pm

Re: Executing code after editing of one cell in datagrid is

Post by vladoportos » Thu Jun 21, 2012 10:06 am

Thats not exactly what I need as EditValue pKey is called before editing as far as I understand.

What I want to do is have some action called after the editing is done.

What I want to achieve is automatic update of SQLite which is reflection of data in datagrid, so when user edit one cell and add some information in to, right after he is done editing code will execute that will store the new info in DB.

Something like onFinishEdit but I can't find were are all the calls are for custom row behavior...

Klaus
Posts: 14213
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Executing code after editing of one cell in datagrid is

Post by Klaus » Thu Jun 21, 2012 10:27 am

Hi Vladimir,

check the "DataGrid" docs (PDF) for "CloseFieldEditor", that's the message you want to trap.

Get the PDF here:
http://lessons.runrev.com/m/datagrid


Best

Klaus

vladoportos
Posts: 17
Joined: Wed Jun 20, 2012 8:21 pm

Re: Executing code after editing of one cell in datagrid is

Post by vladoportos » Thu Jun 21, 2012 10:34 am

Ahhh exactly what I was looking for !, many thanks

Post Reply