Deleting rows in dat grid forms

Gerry Orkin gerry.orkin at gmail.com
Wed Jan 8 18:37:55 EST 2014


Hi all

I have a delete button in the row template group of a data grid form.

When the user touches there delete button I do this:

deleteRecord the dgIndex of me

...and I handle that command in the card script with:

on deleteRecord whichRow
    dispatch "deleteline" to group "datagrid" with whichRow 
end deleteRecord

That deletes the specified row, but something isn't working right. For example, if the delete button in row 4 is touched, the fourth row in the data grid is deleted which moves the 5th row into the 4th row position. But I then touch the delete button in the (new) 4th row, the dgIndex passed to my delete script isn't 4...it's 5.

Why is that, and how do I fix it? In the past when I've done a row delete in a data grid form I've simply deleted the record in my database, rebuilt the data grid array and re-populated the data grid. So how do I do a row delete without having to do that?

Cheers

Gerry





More information about the use-livecode mailing list