Sha256: 8acd69a766ca7defb026031adf60eb11f0f5ef918382ad82d17db38d9150df6c

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

// ComboBox that gets options from the server (used in both grids and panels)
Ext.define('Ext.netzke.ComboBox', {
  extend        : 'Ext.form.field.ComboBox',
  alias         : 'widget.netzkeremotecombo',
  valueField    : 'value',
  displayField  : 'text',
  triggerAction : 'all',
  forceSelection: true,

  initComponent : function(){
    var modelName = this.parentId + "_" + this.name;

    if (this.blankLine == undefined) this.blankLine = "---";

    Ext.define(modelName, {
        extend: 'Ext.data.Model',
        fields: ['value', 'text']
    });

    var store = new Ext.data.Store({
      model: modelName,
      proxy: {
        type: 'direct',
        directFn: Netzke.providers[this.parentId].getComboboxOptions,
        reader: {
          type: 'array',
          root: 'data'
        }
      }
    });

    store.on('beforeload', function(self, params) {
      params.params.attr = this.name;
    },this);

    // insert a selectable "blank line" which allows to remove the associated record
    if (this.blankLine) {
      store.on('load', function(self, params) {
        // append a selectable "empty line" which will allow remove the association
        self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
      }, this);
    }

    // If inline data was passed (TODO: is this actually working?)
    if (this.store) store.loadData({data: this.store});

    this.store = store;

    this.callParent();
  },

});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
netzke-basepack-0.11.2 javascripts/netzkeremotecombo.js
netzke-basepack-0.11.1 javascripts/netzkeremotecombo.js
netzke-basepack-0.11.0 javascripts/netzkeremotecombo.js
netzke-basepack-0.10.1 javascripts/netzkeremotecombo.js
netzke-basepack-0.10.0 javascripts/netzkeremotecombo.js
netzke-basepack-0.9.0 javascripts/netzkeremotecombo.js
netzke-basepack-0.10.0.rc2 javascripts/netzkeremotecombo.js
netzke-basepack-0.9.0.rc1 javascripts/netzkeremotecombo.js