As far as I can tell, the date formatters on tableview cells aren't working... but perhaps I'm missing something.
I have a column in the table bound to a CPDate property on arrangedObjects. The TextCell in that column has a DateFormatter attached and that was set for the 'short' format for both date and time.
What happens is the original rendering of text is the cell is some full format and always shows a date of midnight new year's day for the year 2000 (though adjusted to Pacific Time this is actually rendered as late in 1999). The actual object has a different value for its CPDate, which I've checked in the debugger and tracing to log.
When I click on the cell to edit it, I get the correctly formatted text for this (wrong) date displayed in the cell editor, but if I change the date shown "1999-12-31", then I can never get the edited text to validate and the edit accepted.
If I just accept this 1999-12-31 date, then the underlying object has it's property set for this date (so the binding is working) and this will result in my model being updated with this dodgy date.
Is there some odd interaction with cells, formatters and binding?
I'm pretty sure I have the xib set up right.
Actually, trying to set the formatter in a delegate method might not actually work, but you at least can check to see whether the formatter is being set at all. I think when I ran across this issue some time ago I ended up using data source methods and pre-formatting the cell value. Somewhere along the line that issue was fixed, as now I use bindings and formatters set in IB.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
> On May 24, 2019, at 7:49 AM, Keary Suska <cappu...@esoteritech.com> wrote:
>
> Setting in IB should work, at least it has worked for me in cell based table views (as long as you are using a somewhat recent version of Capp). If you get the same date display whether the date is null or not, it could mean that the formatter is being applied before the cell value is set, or something odd with the null placeholder. Reloading the table might fix the cells that have a valid date in them in the first case, and putting a specific date as the null placeholder might reveal the issue.
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>> On May 23, 2019, at 6:21 PM, Luke Evans <luke...@gmail.com> wrote:
>>
>> Thanks.
>>
>> I set it in Interface Builder, which is certainly what I’d prefer to do, but I’ll embark on some exploration of other ways.
>> Too bad about not handling nulls as well, as this is an optional date and I had set the Null placeholder in the binding in the hope of saying “No date set”, but indeed that isn’t working either.
>>
>>
>>> On May 23, 2019, at 3:19 PM, Keary Suska <cappu...@esoteritech.com> wrote:
>>>
>>> Do you set the formatter in Interface Builder, or programmatically? If you instead set the formatter in a tableview delegate method, does it work better? Note that CPDateFormatter doers not handle null dates properly, o you might need to handle that case differently.
>>>
>>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to objec...@googlegroups.com.
>> To post to this group, send email to objec...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/objectivej.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/objectivej/29042D53-A07B-407D-8A4A-3CDEAD1B21E1%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to objec...@googlegroups.com.