Replacing a tableView Cell with null
Replacing a tableView Cell with null
- Subject: Replacing a tableView Cell with null
- From: Steven Hamilton <email@hidden>
- Date: Sat, 6 Jun 2009 09:01:02 +1000
Hi,
I have an NSTableview populated by bindings to Core Data. In one
column I have a popupbutton (bad idea as its slow, I know) and in
another I have a checkbox. I only want the checkbox to be available
when certain items from the popupbutton are selected. To try and do
this I've implemented;
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
if ([[tableColumn identifier] isEqualToString:@"budget"]) {
//Fetch account type
Account *selectedAccount = [[accountsController arrangedObjects]
objectAtIndex:row];
if ([[selectedAccount valueForKeyPath:@"type.name"]
isEqualToString:@"Assets"]
|| [[selectedAccount valueForKeyPath:@"type.name"]
isEqualToString:@"Liabilities"]){
[cell setEnabled:FALSE];
[selectedAccount setValue:FALSE forKey:@"envelopeVisible"];
}
}
}
This disables the checkbox which nearly works barring a slight issue
with refresh. I'd much rather though just display nothing at all and
only have the checkbox visible on the rows that need it. Is there a
way to change the cell to just blank rather than a checkbox? Or am I
going about this the wrong way and set the column to blank and
programmatically create checkboxes when I need them?
_______________________________________________
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