How to load data from NSDictionary to NSTableView?

  • Hi to all ,

    I have a NSDictionary with the keys of the columns i want to show into
    a NSTableView.

    I take a look at Apple Documentation , but i don't find how to load
    data from NSDictionary to NSTableView.

    Anyone can give a sample code?

    Thanks.
  • You can use the [dictionary allKeys]; method which returns an NSArray of keys.

    Then for the first column, return the value of the NSArray at rowIndex.
    For the second column, get the value of NSArray at rowIndex and use it
    as the key in [dictionary objectForKey:...];

    On 10/12/06, Raul <rzraul...> wrote:
    > Hi to all ,
    >
    > I have a NSDictionary with the keys of the columns i want to show into
    > a NSTableView.
    >
    > I take a look at Apple Documentation , but i don't find how to load
    > data from NSDictionary to NSTableView.
    >
    > Anyone can give a sample code?
    >
    > Thanks.

    --
    Mark Munz
    unmarked software
    http://www.unmarked.com/
  • Thanks for your reply , but i don't know how to load to the first
    column or second column of the NSTableView.

    What methods i have to use?

    > You can use the [dictionary allKeys]; method which returns an NSArray of keys.
    >
    > Then for the first column, return the value of the NSArray at rowIndex.
    > For the second column, get the value of NSArray at rowIndex and use it
    > as the key in [dictionary objectForKey:...];
    >
    >> Hi to all ,
    >>
    >> I have a NSDictionary with the keys of the columns i want to show into
    >> a NSTableView.
    >>
    >> I take a look at Apple Documentation , but i don't find how to load
    >> data from NSDictionary to NSTableView.
    >>
    >> Anyone can give a sample code?
    >>
    >> Thanks.
    >
    > --
    > Mark Munz
    > unmarked software
    > http://www.unmarked.com/
    >
  • On 10/12/06, Raul <rzraul...> wrote:
    > Hi to all ,
    >
    > I have a NSDictionary with the keys of the columns i want to show into
    > a NSTableView.
    >
    > I take a look at Apple Documentation , but i don't find how to load
    > data from NSDictionary to NSTableView.
    >
    > Anyone can give a sample code?

    Look up and understand NSTableDataSource [1]. Also from the API docs
    for NSTableView note the "Table View Programming Guide" link ... that
    document will answer your question.

    In particular review...

    <http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/Tasks/U
    singTableDataSource.html#//apple_ref/doc/uid/20000117
    >

    -Shawn

    [1] <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Pro
    tocols/NSTableDataSource_Protocol/Reference/Reference.html
    >
  • Hi all,

      Can somebody tell me how we can store the data of NSTextView field into NSDictionary.
      NSDictionary is capable of storing data of NSTextField using plist but when trying to store data of NSTextView it is giving some problems.

      Regars,
      Friendy


    ---------------------------------
    Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
  • On Thu, 12 Oct 2006 16:00:03 +0200, Raul <rzraul...> said:
    > Hi to all ,
    >
    > I have a NSDictionary with the keys of the columns i want to show into
    > a NSTableView.
    >
    > I take a look at Apple Documentation , but i don't find how to load
    > data from NSDictionary to NSTableView.

    Could you be clearer on what you want an example of? Do you mean you have an
    array of dictionaries where the dictionary keys are the names of the
    columns? m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • >> Hi to all ,
    >>
    >> I have a NSDictionary with the keys of the columns i want to show into
    >> a NSTableView.
    >>
    >> I take a look at Apple Documentation , but i don't find how to load
    >> data from NSDictionary to NSTableView.
    >
    > Could you be clearer on what you want an example of? Do you mean you have an
    > array of dictionaries where the dictionary keys are the names of the
    > columns? m.
    >

    I have one NSDictionary with 3 keys : Name , Phone and Country and the
    data for these keys.

    Now i have to show this data inside of NSTableView.

    I want an example of how to load the NSDictionary into NSTableView.

    Thanks.
  • On or about 10/14/06 7:02 PM, thus spake "Raul" <rzraul...>:

    >>> Hi to all ,
    >>>
    >>> I have a NSDictionary with the keys of the columns i want to show into
    >>> a NSTableView.
    >>>
    >>> I take a look at Apple Documentation , but i don't find how to load
    >>> data from NSDictionary to NSTableView.
    >>
    >> Could you be clearer on what you want an example of? Do you mean you have an
    >> array of dictionaries where the dictionary keys are the names of the
    >> columns? m.
    >>
    >
    > I have one NSDictionary with 3 keys : Name , Phone and Country and the
    > data for these keys.
    >
    > Now i have to show this data inside of NSTableView.
    >
    > I want an example of how to load the NSDictionary into NSTableView.

    Load it in what configuration? How did you want this data to be displayed?
    You've only *one* dictionary? With only three keys? So you only have three
    pieces of data??? Why would a table be a good way to show that? Do you want
    to have a table with just one row - one value per column? Be more specific,
    please. m.

    --
    matt neuburg, phd = <matt...>, http://www.tidbits.com/matt/
    pantes anthropoi tou eidenai oregontai phusei
    AppleScript: the Definitive Guide - Second Edition!
    http://www.amazon.com/gp/product/0596102119
    Take Control of Word 2004, Tiger, and more -
    http://www.takecontrolbooks.com/tiger-customizing.html
    Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
  • Op 15-okt-2006, om 4:02 heeft Raul het volgende geschreven:

    >>> Hi to all ,
    >>>
    >>> I have a NSDictionary with the keys of the columns i want to show
    >> into
    >>> a NSTableView.
    >>>
    >>> I take a look at Apple Documentation , but i don't find how to load
    >>> data from NSDictionary to NSTableView.
    >>
    >> Could you be clearer on what you want an example of? Do you mean
    >> you have an
    >> array of dictionaries where the dictionary keys are the names of the
    >> columns? m.
    >>
    >
    > I have one NSDictionary with 3 keys : Name , Phone and Country and the
    > data for these keys.
    >
    > Now i have to show this data inside of NSTableView.
    >
    > I want an example of how to load the NSDictionary into NSTableView.
    >
    > Thanks.

    My guess is that you have a Array with Dictionaries. As other people
    say we need more info.

    Maybe can those article's help you. Read them first.

    http://www.macdevcenter.com/pub/a/mac/2006/08/08/nstableview-
    class.html?page=5
    http://www.cocoadev.com/index.pl?NSTableViewTutorial

    and do a search at Cocoadev with NSTableView. Or use google ( even
    when it is not your friend ) with 'NSTableView dataSource
    NSDictionary' or the like.

    HTH
previous month october 2006 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