Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: Steven Riggs <email@hidden>
- Date: Tue, 04 Nov 2008 23:49:27 -0500
One quick correction... I just noticed that you wanted selected
objects so the first line should be...
NSArray *array = [yourArrayController selectedObjects];
Cheers!
Steven Riggs
http://www.stevenriggs.com
On Nov 4, 2008, at 11:46 PM, Steven Riggs wrote:
You would think that would work. I don't know why it doesn't but
I've been here before. You have to read the data from the array
controller. But there is a way to line up the data from the array
controller to match the organization of the table view. This feels
like a workaround for not being able to get the data straight from
the table view but something like this should work for you...
NSArray *array = [yourArrayController arrangedObjects];
id thing;
NSArray *columns = [yourTableView tableColumns];
id column;
NSMutableString *content = [NSMutableString string];
for (thing in array) {
for (column in columns) {
if ([[column identifier] isEqual:@"MediaType"]) {
[content appendFormat:@"%@,", thing.mediaType];
}
if ([[column identifier] isEqual:@"Category"]) {
[content appendFormat:@"%@", thing.category];
}
}
}
NSLog(@"%@",content);
Cheers!
Steven Riggs
http://www.stevenriggs.com
On Nov 4, 2008, at 6:13 AM, Mahaboob wrote:
Hi,
My TableView contains some columns. I need to access all the column
values
of all selected rows. So I coded like:
NSString *content;
for(i=0;i<[tableView numberOfRows];i++)
{
if([tableView isRowSelected:i])
{
content = [[[[[tableView
tableColumnWithIdentifier:@"MediaType"] dataCellForRow:i]stringValue]
stringByAppendingString:@","]
stringByAppendingString:[[[tableView
tableColumnWithIdentifier:@"Category"]
dataCellForRow:i]stringValue]] ;
NSLog(@"%@",content);
}
}
But the log file shows last selected row values only. Where I got
wrong?
How can I access all selected row values?
Thanks in advance.
_______________________________________________
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:
@me.com
This email sent to email@hidden
_______________________________________________
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