Sha256: 06319d078ac5e98ac8a78869929bc98c6f091d90d5259418b017b35d56853cec

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 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;
        if (assignee) {
          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

2 entries across 2 versions & 1 rubygems

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