My tableView method will not fire - Hillegass Chapter 28

Discussion in 'Mac Programming' started by John Baughman, Aug 31, 2009.

  1. John Baughman macrumors member

    Joined:
    Oct 27, 2003
    #1
    I have checked and rechecked things but I cannot get tableView.objectValueForTableColumn:row to fire.

    numberOfRowsInTableView is the only table view method getting called when I call [tableView reloadData].

    I have set the App Controller as the data source for the Table View and App Controller tableView outlet is set to the Table View. What am I missing.

    John
     
  2. scootaru macrumors 6502

    Joined:
    Nov 7, 2008
    Location:
    Columbus, OH
    #2
    If it's not being called at all, the method probably isn't spelled exactly as it should be in the implementation file. Post your objectValueForTableColumn method.
     
  3. John Baughman thread starter macrumors member

    Joined:
    Oct 27, 2003
    #3
    Code:
    - (id)tableView:(NSTableView *)aTableView
                   objectValueForTableColumn:(NSTableColumn *)aTableColumn      
                                        row:(int)row
    {
    	
    	
    }
    
    
     
  4. scootaru macrumors 6502

    Joined:
    Nov 7, 2008
    Location:
    Columbus, OH
    #4
    As you already know, that is the correct method. You didn't mention it, but did you also link the delegate of tableView to the AppController object?
     
  5. John Baughman thread starter macrumors member

    Joined:
    Oct 27, 2003
    #5
    No, but I tried to do that now and it still does not work. To link the delegate I right clicked the Table View and dragged from the Outlet Delegate line to the App Controller... Right?

    In the sample code for the book Hillegass did not link the delegate. I can't test the sample as it is not complete in that it does not contain the code for creating a required Amazon.com web services request.

    I think what I am going to do unless someone helps me out, is add the necessary code to the sample project and see if tableView method works there.

    John
     
  6. mdeh macrumors 6502

    Joined:
    Jan 3, 2009
    #6
    Try and clean the project, then compile and run.
     
  7. John Baughman thread starter macrumors member

    Joined:
    Oct 27, 2003
    #7
    Still no luck. :confused:
     
  8. John Baughman thread starter macrumors member

    Joined:
    Oct 27, 2003
    #8
    I found the problem, but don't understand why it breaks the call to the tableView method especially since numberOfRowsInTableView does get called.

    In this app we have the following code..

    Code:
    [itemNodes release];
    itemNodes = [[doc   nodesForXPath:@"ItemSearchResponse/Items/Item" error:&error] retain];
    if (!itemNodes) {
       NSAlert *alert = [NSAlert alertWithError:error];
       [alert runModal];
       return;
    }
    
    // Update the interface
    [tableView reloadData];
    [progress stopAnimation:nil];
    
    
    My mistake was instead of having @"ItemSearchResponse/Items/Item" I had @"ItemsSearchResponse/Items/Item". Note the extra s in @"ItemSearch...". Even with the typo, it does not fall into alert for (!itemNodes). So why does reloadData call numberOfRowsInTableView but not the tableView method.

    Thanks for all who tried to help. I think I am good to continue on.

    John
     

Share This Page