Hi Gerry,

You are passing an index to the deleteline command.

In datagrids, indexes and lines are different things:
http://lessons.runrev.com/s/lessons/m/datagrid/l/7344-data-grid-api

Try:
on deleteRecord whichRow
    dispatch "deleteIndex" to group "datagrid" with whichRow
end deleteRecord



On Thu, Jan 9, 2014 at 12:37 AM, Gerry Orkin <gerry.or...@gmail.com> wrote:
> 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
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



Best,
-- 
Zryip TheSlug
http://www.aslugontheroad.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to