Deleting rows in dat grid forms

Peter Haworth pete at lcsql.com
Wed Jan 8 21:01:25 EST 2014


Hi Gerry,
You're passing in the dgIndex of the row, not the line number.  The dgIndex
is assigned when data is loaded into the datagrid and never changes which I
think explains your problem.

You can either use deleteIndexes or pass in the dgHilitedLine of the
datagrid and continue to to use deleteLine.

Hope that helps,

Pete

Pete
lcSQL Software <http://www.lcsql.com>


On Wed, Jan 8, 2014 at 3:37 PM, Gerry Orkin <gerry.orkin at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list