Sha256: 673dda17aa44a1f7665772e6da21d8b16011d44d41e6814d5488332b859cfa51

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

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

  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('show', this.unCheckNodes);
  },

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

Version data entries

1 entries across 1 versions & 1 rubygems

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