• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reordering a table insanity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reordering a table insanity


  • Subject: Re: Reordering a table insanity
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 28 Nov 2012 17:02:45 -0800

On Nov 28, 2012, at 16:35 , Graham Cox <email@hidden> wrote:

> So the question now is, can the table reordering with animation be made to work in the undo case?

I think it's doable. Note that the existing code is simple because there's no need to adjust the indexes in the selectionIndexes set at each step of the loop -- the indexes for the unmoved rows are still valid, even though the indexes for moved rows aren't.

To go in the opposite direction, it seems like you'd need to take the destination set (a clump of contiguous indexes), and divide it into two parts -- the indexes that need to go somewhere below the clump and the indexes that need to go somewhere above the clump.

In order to avoid adjusting indexes, you'd then need to do the loops in the *opposite* order: from lowest to highest in the "below" subset and from highest to lowest in the "above" subset. I *think* that at each iteration, you'd be putting back the row that would make the index in the next iteration valid again.

That means you'd need a different though similar twelve lines of code to implement the reverse algorithm. That in turn means you'd need to know which direction you were going, so there might need to be a 3rd "direction" parameter (or it might be clear from the context, depending on how your undo works).

Does that sound plausible?


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Reordering a table insanity
      • From: Graham Cox <email@hidden>
References: 
 >Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Does anyone find Restore Snapshot kind of weak?
  • Next by Date: Re: Reordering a table insanity
  • Previous by thread: Re: Reordering a table insanity
  • Next by thread: Re: Reordering a table insanity
  • Index(es):
    • Date
    • Thread