Inserting object in array after sorting
Inserting object in array after sorting
- Subject: Inserting object in array after sorting
- From: Bruce Truax <email@hidden>
- Date: Tue, 16 Nov 2004 10:51:19 -0500
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.
Bruce
_______________________________________________
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