Page 1 of 1
Delete Datagrid row
Posted: Wed Jul 18, 2012 3:57 pm
by link76
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

Re: Delete Datagrid row
Posted: Wed Jul 18, 2012 4:02 pm
by Klaus
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
Re: Delete Datagrid row
Posted: Wed Jul 18, 2012 8:26 pm
by Newbie4
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?
Re: Delete Datagrid row
Posted: Thu Jul 19, 2012 6:11 am
by link76
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
