TableView not loading completely

  • Hi

    I have a table view which would show 13 rows at a given time. The vertical and horizontal scroll are enabled. All the attributes are standard.
    When I load the data, I can see only the first 13 rows getting populated and the application doesn't respond when I try scrolling down.

    What should I do here?

    Thank you
    DG


    ---------------------------------
    Get the freedom to save as many mails as you wish. Click here to know how.
  • On Oct 15, 2007, at 7:04 PM, deepak gopal wrote:

    > I have a table view which would show 13 rows at a given time. The
    > vertical and horizontal scroll are enabled. All the attributes are
    > standard.
    > When I load the data, I can see only the first 13 rows getting
    > populated and the application doesn't respond when I try scrolling
    > down.

    Are you using a data source or bindings to provide the table view with
    objects to display?

    If you're using a data source, what are you returning from its -
    numberOfRowsInTableView: method?

      -- Chris
  • Hi

    I caught my mistake.

    Before I was doing this:
    - (IBAction) loadTable {
    NSDictionary *plistDictionary =
      [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
      plistArray_ = [plistDictionary valueForKey:@"Functions"];
    }

    But my Dictionary died when I exited the method so all I had to do is this
    - (IBAction) loadTable {
      NSDictionary *plistDictionary =
      [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
      [plistArray_ removeAllObjects];
      [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary valueForKey:@"Functions"]];
    }

    and it started working.
    Please let me know if I am doing anything wrong here.

    Thank you
    DG

    ----- Original Message ----
    From: deepak gopal <deengg...>
    To: cocoa dev <cocoa-dev...>
    Sent: Tuesday, 16 October, 2007 2:11:23 PM
    Subject: Fw: TableView not loading completely

    Hi

    I am using datasource. The value I return from numberOfRowsInTableView
    is in thousands.
    So I should have atleast a 1000 lines of data in the TableView.

    - (int)numberOfRowsInTableView:(NSTableView *)tableView {
      return [plistArray_ count];
    }

    Thank you
    Deepak

    ----- Original Message ----
    From: Chris Hanson <cmh...>
    To: <deepak_gopal_21...>; deepak gopal <deengg...>
    Cc: cocoa dev <cocoa-dev...>
    Sent: Monday, 15 October, 2007 7:56:46 PM
    Subject: Re: TableView not loading completely

    On Oct 15, 2007, at 7:04 PM,
    deepak gopal wrote:

    > I have a table view which would show 13 rows at a given time. The
    > vertical and horizontal scroll are enabled. All the attributes are
    > standard.
    > When I load the data, I can see only the first 13 rows getting
    > populated and the application doesn't respond when I try scrolling
    > down.

    Are you using a data source or bindings to provide the table view with

    objects to display?

    If you're using a data source, what are you returning from its -
    numberOfRowsInTableView: method?

      -- Chris

          Download prohibited? No problem. CHAT from any browser, without
    download.

          Travelling to a new city? Search for ATMs in that city. Go to
    http://in.maps.yahoo.com

          Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php
  • On Oct 16, 2007, at 7:24 PM, deepak gopal wrote:

    > Hi
    >
    > I caught my mistake.
    >
    > Before I was doing this:
    > - (IBAction) loadTable {
    > NSDictionary *plistDictionary =
    > [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    > plistArray_ = [plistDictionary valueForKey:@"Functions"];
    > }
    >
    > But my Dictionary died when I exited the method so all I had to do
    > is this
    > - (IBAction) loadTable {
    > NSDictionary *plistDictionary =
    > [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    > [plistArray_ removeAllObjects];
    > [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary
    > valueForKey:@"Functions"]];
    > }
    >

    You are modifying the datasource without calling "reloadData" on the
    table. you should have a [tableView reloadData] at the end of that
    loadTable method.

    corbin

    >
    > I am using datasource. The value I return from numberOfRowsInTableView
    > is in thousands.
    > So I should have atleast a 1000 lines of data in the TableView.
    >
    > - (int)numberOfRowsInTableView:(NSTableView *)tableView {
    > return [plistArray_ count];
    > }
    >
  • On Wednesday, October 17, 2007, at 09:20AM, "Corbin Dunn" <corbind...> wrote:
    >
    > On Oct 16, 2007, at 7:24 PM, deepak gopal wrote:
    >
    >> Hi
    >>
    >> I caught my mistake.
    >>
    >> Before I was doing this:
    >> - (IBAction) loadTable {
    >> NSDictionary *plistDictionary =
    >> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    >> plistArray_ = [plistDictionary valueForKey:@"Functions"];
    >> }
    >>
    >> But my Dictionary died when I exited the method so all I had to do
    >> is this
    >> - (IBAction) loadTable {
    >> NSDictionary *plistDictionary =
    >> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    >> [plistArray_ removeAllObjects];
    >> [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary
    >> valueForKey:@"Functions"]];
    >> }
    >>
    >
    >
    > You are modifying the datasource without calling "reloadData" on the
    > table. you should have a [tableView reloadData] at the end of that
    > loadTable method.

    In addition, arrayByAddingObjectsFromArray: shouldn't be modifying the plistArray_ variable.  It's returning a new instance of NSArray, and you're ignoring it, so I don't see how this could work.  You may want to just use [plistArray_ setArray:[plistDictionary valueForKey:@"Functions"]] and save the removeAllObjects step.

    --
    adam
  • Yes I do have [tableView reloadData]; Sorry I didn't add that.

    DG

    ----- Original Message ----
    From: Corbin Dunn <corbind...>
    To: deepak gopal <deepak_gopal_21...>
    Cc: cocoa dev <cocoa-dev...>
    Sent: Wednesday, 17 October, 2007 9:17:57 AM
    Subject: Re: TableView not loading completely

    On Oct 16, 2007, at 7:24 PM, deepak gopal wrote:

    > Hi
    >
    > I caught my mistake.
    >
    > Before I was doing this:
    > - (IBAction) loadTable {
    > NSDictionary *plistDictionary =
    > [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    > plistArray_ = [plistDictionary valueForKey:@"Functions"];
    > }
    >
    > But my Dictionary died when I exited the method so all I had to do
    > is this
    > - (IBAction) loadTable {
    > NSDictionary *plistDictionary =
    > [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    > [plistArray_ removeAllObjects];
    > [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary
    > valueForKey:@"Functions"]];
    > }
    >

    You are modifying the datasource without calling "reloadData" on the
    table. you should have a [tableView reloadData] at the end of that
    loadTable method.

    corbin

    >
    > I am using datasource. The value I return from
    numberOfRowsInTableView
    > is in thousands.
    > So I should have atleast a 1000 lines of data in the TableView.
    >
    > - (int)numberOfRowsInTableView:(NSTableView *)tableView {
    > return [plistArray_ count];
    > }
    >


          Get the freedom to save as many mails as you wish. To know how, go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
  • I intialize my plistArray in my init.
    plistArray_ = [[NSMutableArray alloc] init];
    I used removeAllObjects & arrayByAddingObjectsFromArray because I plan to reload the same dataSource multiple times based on the selections of my PopUpButton.

    But yes setArray would be better.

    Thank you
    DG

    ----- Original Message ----
    From: Adam R. Maxwell <amaxwell...>
    To: Corbin Dunn <corbind...>
    Cc: cocoa dev <cocoa-dev...>; deepak gopal <deepak_gopal_21...>
    Sent: Wednesday, 17 October, 2007 9:26:23 AM
    Subject: Re: TableView not loading completely


    On Wednesday, October 17, 2007, at 09:20AM, "Corbin Dunn"
    <corbind...> wrote:
    >
    > On Oct 16, 2007, at 7:24 PM, deepak gopal wrote:
    >
    >> Hi
    >>
    >> I caught my mistake.
    >>
    >> Before I was doing this:
    >> - (IBAction) loadTable {
    >> NSDictionary *plistDictionary =
    >> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    >> plistArray_ = [plistDictionary valueForKey:@"Functions"];
    >> }
    >>
    >> But my Dictionary died when I exited the method so all I had to do
    >> is this
    >> - (IBAction) loadTable {
    >> NSDictionary *plistDictionary =
    >> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
    >> [plistArray_ removeAllObjects];
    >> [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary
    >> valueForKey:@"Functions"]];
    >> }
    >>
    >
    >
    > You are modifying the datasource without calling "reloadData" on the
    > table. you should have a [tableView reloadData] at the end of that
    > loadTable method.

    In addition, arrayByAddingObjectsFromArray: shouldn't be modifying the
    plistArray_ variable.  It's returning a new instance of NSArray, and
    you're ignoring it, so I don't see how this could work.  You may want to
    just use [plistArray_ setArray:[plistDictionary
    valueForKey:@"Functions"]] and save the removeAllObjects step.

    --
    adam

          Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today