Re: Table selection and bindings
Re: Table selection and bindings
- Subject: Re: Table selection and bindings
- From: Quincey Morris <email@hidden>
- Date: Tue, 14 Feb 2017 10:45:33 -0800
On Feb 14, 2017, at 09:25 , Keary Suska <email@hidden> wrote:
>
>> On Feb 14, 2017, at 8:37 AM, John Brownie <email@hidden <mailto:email@hidden>> wrote:
>>
>> Am I doing things incorrectly, or is there something that I can do to ensure that the change to the underlying array shown by the table triggers a selection change?
>
> If you are otherwise getting delegate calls when you manually (i.e. NOT programmatically) change the selection, then you are running into the situations where notifications are not sent when programmatic selection changes are made.
+1 what Keary said.
But there’s another question, which is why your selection is changing at all when you edit the object it represents. One possibility is that you’re invoking a reloadData on the table view when updating your model. If you do that, you must also re-establish the desired selection after the reload. Or, if you’re simply replacing the entire underlying array with a new instance that contains the modified object, the table view might treat that as a reload, depending on how your table view content is connected to your data model.
So, I think you are probably doing something “incorrectly”, in the sense that you need a lighter hand on the model update, or you need an extra step at the end of the update. Currently, it sounds like you are effectively but unintentionally clearing the selection programmatically, leading to the situation Keary describes.
_______________________________________________
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