Delete Datagrid row

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

Delete Datagrid row

Post by link76 » Wed Jul 18, 2012 3:57 pm

Hello,

in my datagrid I want to delete the selected row, ??

Code: Select all

on MouseUp
put the dgHilitedIndex of group "my dg" into theIndex
DeleteIndex theIndex
end MouseUp
but not work :(

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

Re: Delete Datagrid row

Post by Klaus » Wed Jul 18, 2012 4:02 pm

Hi Link76,

since "deleteindex" is a special DataGrid command, you need to "send" it to the DatagGrid!

Code: Select all

on MouseUp
  put the dgHilitedIndex of group "my dg" into theIndex
  send "DeleteIndex theIndex" to grp "my dg"
end MouseUp
Or you can also use "dispatch":

Code: Select all

on MouseUp
  put the dgHilitedIndex of group "my dg" into theIndex
  dispatch "DeleteIndex" to grp "my dg" with theIndex
end MouseUp
Best

Klaus

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: Delete Datagrid row

Post by Newbie4 » Wed Jul 18, 2012 8:26 pm

I just tried that code but the deleted record is still there in the group/array. Do I have to do something to save the results?

The row gets deleted from the screen and when I get the number of lines, it is correct. But if I pick another group, then come back to this gropu, the deleted row is there again.

Does the array have to be updated or something?
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

Re: Delete Datagrid row

Post by link76 » Thu Jul 19, 2012 6:11 am

Klaus wrote:Hi Link76,

since "deleteindex" is a special DataGrid command, you need to "send" it to the DatagGrid!

Code: Select all

on MouseUp
  put the dgHilitedIndex of group "my dg" into theIndex
  send "DeleteIndex theIndex" to grp "my dg"
end MouseUp
Or you can also use "dispatch":

Code: Select all

on MouseUp
  put the dgHilitedIndex of group "my dg" into theIndex
  dispatch "DeleteIndex" to grp "my dg" with theIndex
end MouseUp
Best

Klaus
thank you it's OK :)

Post Reply