Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Editing dates in table views

Editing dates in table views
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Sep 23, 2003, 02:19 PM
 
Hi,

This should be an easy one to answer, I hope

I have a table view which has a column for dates. I formatted the column using a date formatter in my awakeFromNib; everything looks fine. When I double click to edit the date column and change the date from 9/02/03 to 9/23/03 I just get a system beep and the field stays in "editing mode". If I delete the entire date and hit return, it ends editing and then crashes.

Any suggestions?
     
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 23, 2003, 08:03 PM
 
Sounds like it thinks 9/23/03 is not a valid date (which it's not in most countries). Can you post your formatter code here or otherwise just double check to make sure that it allows this date format?
     
Forum Regular
Join Date: Aug 2003
Status: Offline
Reply With Quote
Sep 23, 2003, 10:57 PM
 
9/23/03 is definitely a valid date format. Do you have the date formatter set to use that date format? That might be the problem.
-- Devin Lane, Cocoa Programmer
     
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 23, 2003, 11:08 PM
 
Originally posted by Devin Lane:
9/23/03 is definitely a valid date format. Do you have the date formatter set to use that date format? That might be the problem.
Being a valid date depends on what the date format is for that text object's formatter.
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Sep 24, 2003, 12:00 AM
 
I use the users short date format from System Prefs so I think the 9/23/03 is a valid date, because it populates the column with dates in that format.

Here is the code that I use to format the table column cell:

NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] initWithDateFormat:
[[NSUserDefaults standardUserDefaults] objectForKey:NSShortDateFormatString]
allowNaturalLanguage:NO] autorelease];

[[[tableView tableColumnWithIdentifier:dateColumn] dataCell] setFormatter:dateFormat];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:11 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2