One way I have seen this done is to make the order field a decimal, and then calculate its order as halfway between the previous and next record's order values. This gives essentially unlimited ability to insert rows.
The order field values might be ugly, and not human readable, but it would prevent having to update every row and save the entire data set. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen Sent: Wednesday, March 26, 2008 4:42 PM To: [email protected] Subject: Re: [flexcoders] ORDERING datagrid rows by dragging ***ROWS*** to form correct order?? not quite sure what you are doing here, but when you enable drag and move on a DG this allows users to re-order the rows. This re-ordering mutates the dataProvider behind the DG. So, why not just send this DG.dataProvider to your server and let it do the looping magic on it? DK On Wed, Mar 26, 2008 at 3:23 PM, ozflex <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Sorry I just realised I put columns instead of ROWS in the subject! ... so far it seems like the only way to do this is to loop over each row to find out what its index is and then send that to mySQL :S argh.. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "ozflex" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I have a normal dg which is pulling data from MySQL db and i'm trying > to figure out the best way to allow users to drag the rows to re-order > as per however they may want it.. > > This is what I thought buy some feedback would be great! > > 1. Add 'order' column to sql db > 2. Set inital order for each row > 3. sort by order desc when pulling db into dg > 4. Create function to: > a. when a user drops a row into desired position make each rows > order = each rows index > b. update mysql db when all changes are complete > > I also thought, maybe remember oldOrder val, + 1 to each order value > from point of insertion until order = oldOrder?? > > Obviously this method has issues when the # of rows grows.. so thats > why I would love some help with this! there must be a better way :) > > Thanks in advance! > > Matt (OzFlex Adobe User Group - Melbourne) > -- Douglas Knudsen http://www.cubicleman.com <http://www.cubicleman.com> this is my signature, like it?

