• 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: Bruce Truax <email@hidden>
  • Date: Tue, 16 Nov 2004 22:24:17 -0500

Thanks for the tip.  I used it to create a workaround.  It is not very clean
but it works.  I also filed a bug report as you suggested.

Bruce


On 11/16/04 3:22 PM, "Scott Anguish" <email@hidden> eloquently wrote:

>
> 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..
>
>
>

--
____________________________________________________________
Bruce E. Truax                 email:  email@hidden
Optical Engineering Consultant

             Diffraction Limited Design LLC
388 Wedgewood Road             voice:  860-276-0450
Southington, CT  06489         fax:    860-620-9026
http://www.dld-llc.com
_____________________________________________________________

 _______________________________________________
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

References: 
 >Re: Inserting object in array after sorting (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: Custom NSToolbarItem
  • Next by Date: Application fails to come to front / show menu bar in Xcode
  • Previous by thread: Re: Inserting object in array after sorting
  • Next by thread: Live scrolling
  • Index(es):
    • Date
    • Thread