Skip to content

Instantly share code, notes, and snippets.

@rklancer
Created October 14, 2010 17:41
Show Gist options
  • Save rklancer/626640 to your computer and use it in GitHub Desktop.
Save rklancer/626640 to your computer and use it in GitHub Desktop.
// THIS DOESN'T WORK (TableController instances end up sharing the one binding object)
Smartgraphs.TableController = SC.ArrayController.extend({
// ...
dataset: null,
/**
Whether to display the table at all
*/
showTableBinding: SC.Binding.not('*dataset.isStreaming'),
//...
});
// THIS WORKS
Smartgraphs.TableController = SC.ArrayController.extend({
// ...
dataset: null,
/**
Whether to display the table at all
*/
isStreamingBinding: '*dataset.isStreaming',
showTable: function () {
// SC.Binding.not() creates a single Binding object that ends up being shared by all TableConrtroller instances
return !this.get('isStreaming');
}.property('isStreaming').cacheable(),
//...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment