Sha256: f5f97c5c30b3a9670096d59c3cd8216fcc1ffce27946114562c620d4650f8366

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

Ext.define('TM.view.assignee.TreeCombo', {
  xtype: 'assignee_treecombo',
  extend: 'Ext.ux.TreeCombo',
  editable: false,
  rootVisible: false,

  setValue: function(valueInit) {
    if(typeof valueInit === 'object') {
      var value = [];
      valueInit.forEach(function(i) {
        value.push(i.assignee_type + '-' + i.assignee_id);
      });
      valueInit = value.join(',');
    }

    this.callParent([valueInit]);
  },

  getSubmitValue: function() {
    var value = [];
    if(!this.value) return value;

    var objs = this.value.split(',');
    objs.forEach(function(i) {
      var node = this.tree.getStore().getNodeById(i);
      if(node) {
        var assignee = node.raw.record;
        var attrs = {
          assignee_id: assignee.get('id'),
          assignee_type: assignee.get('class_name')
        };
        value.push(attrs);
      }
    }, this);

    return value;
  },

  // @protected
  initComponent: function() {
    this.callParent(arguments);

    this.on('render', this.unCheckNodes);
  },

  // @private
  unCheckNodes: function() {
    this.setValue('');
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
task-manager-0.1.5 app/assets/javascripts/task-manager/extjs/app/view/assignee/TreeCombo.js