Sha256: 4149d1e1caefdbe71e1f3b6ff6c8b430baa42e66955c581949e0c4c7f9bffc53

Contents?: true

Size: 1.47 KB

Versions: 9

Compression:

Stored size: 1.47 KB

Contents

Ext.define('Ext.netzke.Tristate', {
  extend: 'Ext.form.FieldContainer',
  alias: 'widget.netzketristate',
  layout: 'hbox',

  mixins: {
    field: 'Ext.form.field.Field'
  },

  setValue: function(value){
    if (this.value != value) this.triggerValue(value);
  },

  getValue: function(){
    return this.value == undefined ? "" : this.value;
  },

  items: [{
    xtype: 'menucheckitem',
    checked: true,
    text: ' ',
    itemId: 'item-true',
    cls: "x-btn-default-toolbar-small nz-btn-tristate",
    activeCls: "",
    listeners: {
      render: function(){
        var el = this.getEl(), me = this;
        el.on('click', function(e){
          e.preventDefault();
          me.ownerCt.triggerValue(true);
        })
      }
    }
  },{
    xtype: 'menucheckitem',
    checked: false,
    itemId: 'item-false',
    text: ' ',
    cls: "x-btn-default-toolbar-small nz-btn-tristate",
    activeCls: "",
    listeners: {
      render: function(){
        var el = this.getEl(), me = this;
        el.on('click', function(e){
          e.preventDefault();
          me.ownerCt.triggerValue(false);
        })
      }
    }
  }],

  triggerValue: function(val){
    if (this.value == val) {
      this.getComponent("item-" + val).removeCls('nz-tristate-selected');
      this.value = undefined;
    } else {
      this.getComponent("item-" + val).addCls('nz-tristate-selected');
      this.getComponent("item-" + !val).removeCls('nz-tristate-selected');
      this.value = val;
    }
  }
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
netzke-basepack-6.5.0.0 javascripts/tristate.js
netzke-basepack-6.5.0.0.rc2 javascripts/tristate.js
netzke-basepack-6.5.0.0.rc1 javascripts/tristate.js
netzke-basepack-1.0.1.0 javascripts/tristate.js
netzke-basepack-1.0.0.1 javascripts/tristate.js
netzke-basepack-1.0.0.0 javascripts/tristate.js
netzke-basepack-1.0.0.0.pre3 javascripts/tristate.js
netzke-basepack-1.0.0.0.pre2 javascripts/tristate.js
netzke-basepack-1.0.0.0.pre javascripts/tristate.js