Page 1 of 1
How to drag-reorder rows in a Data Grid?
Posted: Thu Nov 12, 2020 8:42 am
by smartvn2020
How do I drag-reorder rows in a Data Grid? I have to ask because, of course, it's not documented. I Googled and found some 10-year old threads but the code there didn't work for me.
Re: How to drag-reorder rows in a Data Grid?
Posted: Thu Nov 12, 2020 3:48 pm
by dunbarx
Trevor may chime in here, but I believe you have to kludge this. Something like (super-pseudo)"
Code: Select all
on mouseDown put the value of the "mouseLine" into startLine
create a phantom field containing startLine
on mouseMove set the y value of the phantom to the mouseV
on mouseUp put the value of the mouseLine into endLine
get the dgText of the DG
switch the contents of the two lines
set the dgText to the new configuration
Seems easy...
Craig
Re: How to drag-reorder rows in a Data Grid?
Posted: Thu Nov 12, 2020 5:33 pm
by elanorb
Hi
Data grid forms now have a
dgEditMode property. When in edit mode, the data grid displays an action control of the left hand side of each row and a reorder control on the right that allows you to drag-reorder rows.
We have a lesson on this here
https://lessons.livecode.com/m/datagrid ... -data-grid
If you just want the re-order control and not the action control you can do
Code: Select all
set the dgProps["edit mode action select control"] of group "Data Grid Form" to empty
I hope that helps.
Elanor
Re: How to drag-reorder rows in a Data Grid?
Posted: Thu Nov 12, 2020 5:52 pm
by dunbarx
Well, if not Trevor, then Elanor.
Craig
Re: How to drag-reorder rows in a Data Grid?
Posted: Thu Nov 12, 2020 6:25 pm
by elanorb
I was just passing
