0 Replies Latest reply on Mar 26, 2008 9:16 AM by mhj_________________

    Ordering datagrid rows by dragging rows

    mhj_________________
      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)