• 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: Inserting object in array after sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting object in array after sorting


  • Subject: Re: Inserting object in array after sorting
  • From: Scott Anguish <email@hidden>
  • Date: Tue, 16 Nov 2004 15:22:42 -0500


On Nov 16, 2004, at 10:51 AM, Bruce Truax wrote:



I have an array of objects which are bound to a table view using an
NSArrayController. The "Insert" button is connected to the "insert" action
in the NSArrayController. This calls my


- (void)insertObject:(id)anObject inSurfaceArrayAtIndex:(unsigned int)index

method. All is well and the insertion works as expected until the user
sorts the table by clicking on one of the column headings. Once a column
heading has been selected the "index" value passed to the above method is
always one greater than the last index in the array. Unfortunately, this
behavior is not desirable in my application. I would like to be able to
revert to an unsorted table so the user can insert an object in the middle
of the array in the desired location. I do have one column which numbers
the objects based on their index in the array and even if I sort on this
column putting the objects in the correct order, the index value is still
not corrct.


If I cannot fix this problem I will have to disable sorting. I do not want
to do this because it does provide some benefit to the user.

to unsort, you can call [theArrayController setSortDescriptors:nil]

ideally, it'd be nice if you could click three times on a column header... sorted, sorted reverse order, and unsorted.

    that'd be a bug.. file a bug..



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Inserting object in array after sorting
      • From: Bruce Truax <email@hidden>
References: 
 >Inserting object in array after sorting (From: Bruce Truax <email@hidden>)

  • Prev by Date: Re: Interpreting WebView Clicks
  • Next by Date: Re: newbie memory question
  • Previous by thread: Inserting object in array after sorting
  • Next by thread: Re: Inserting object in array after sorting
  • Index(es):
    • Date
    • Thread