Sha256: 330beeedfd10145ac3d4b0bcd7984e1262a7b40668a9fa04a7df43d45353cdf6

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2007 Sprout Systems, Inc.
// ========================================================================

require('views/button') ;

// A filter button sets a filter property to whatever you specifiy.  It 
// also binds to the same property and updates its isSelected state based
// on that.
SC.FilterButtonView = SC.ButtonView.extend({
  
  filterValue: null, // relay to this property.

  filterOn: null, // when this filter toggle on, it will go to this.
  filterOff: null, // when this filter toggles off, it goes to this.
  
  action: function() {
    var val = this.get('filterValue') ;
    val = (val == this.get('filterOn')) ? this.get('filterOff') : this.get('filterOn') ;
    this.set('filterValue',val) ;  
  },
  
  filterValueObserver: function() {
    var sel = this.get('filterValue') == this.get('filterOn') ;
    if (sel != this.get('isSelected')) this.set('isSelected',sel) ;
  }.observes('filterValue')
  
});                                                                              

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutcore-0.9.0 frameworks/sproutcore/views/filter_button.js
sproutcore-0.9.1 frameworks/sproutcore/views/filter_button.js