Data Source ignored after binding sortDescriptors

  • After establishing a binding for an NSTableView's sortDescriptors, my
    data source methods -numberOfRowsInTableView: and -
    tableView:objectValueForTableColumn:row: stop getting called. But I
    haven't bound the table view's content or any columns in the table
    view--just the sortDescriptors.. Is it really impossible to use a
    data source to supply table values and use bindings to synchronize
    the sort descriptors?

    Allen
  • on 10/9/07 12:09 PM, <Allen.Smith...> purportedly said:

    > After establishing a binding for an NSTableView's sortDescriptors, my
    > data source methods -numberOfRowsInTableView: and -
    > tableView:objectValueForTableColumn:row: stop getting called. But I
    > haven't bound the table view's content or any columns in the table
    > view--just the sortDescriptors.. Is it really impossible to use a
    > data source to supply table values and use bindings to synchronize
    > the sort descriptors?

    There are certain "automagical" bindings that occur when setting certain
    bindings (particularly column value bindings), and you may be running into
    one of these. Why not set an outlet and use -setSortDescriptors: instead?

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • On Oct 9, 2007, at 2:37 PM, Keary Suska wrote:

    > on 10/9/07 12:09 PM, <Allen.Smith...> purportedly said:
    >
    >> After establishing a binding for an NSTableView's sortDescriptors, my
    >> data source methods -numberOfRowsInTableView: and -
    >> tableView:objectValueForTableColumn:row: stop getting called. But I
    >> haven't bound the table view's content or any columns in the table
    >> view--just the sortDescriptors.. Is it really impossible to use a
    >> data source to supply table values and use bindings to synchronize
    >> the sort descriptors?
    >
    > There are certain "automagical" bindings that occur when setting
    > certain
    > bindings (particularly column value bindings), and you may be
    > running into
    > one of these.

    I presume you are referring to the bindings the documentation vaguely
    refers to as "being created automatically when the initial
    NSTableColumn binding is made." But it must be more complicated than
    that; I never bound any table columns. Furthermore, when I log
    [tableView infoForBinding:@"content"], etc., I get nil. Only the
    binding I actually established returns any information.

    > Why not set an outlet and use -setSortDescriptors: instead?

    Because bindings are supposed to save me the bother of writing glue
    code to synchronize shared data, which in this case happens to be my
    sort descriptors and selection indexes. But it would appear I have
    stumbled upon a case where bindings decide to do more than advertised.

    Allen
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