Skip to content

Instantly share code, notes, and snippets.

@moduscreate
Created August 5, 2011 21:06
Show Gist options
  • Save moduscreate/1128529 to your computer and use it in GitHub Desktop.
Save moduscreate/1128529 to your computer and use it in GitHub Desktop.
Ext.ns('IbwUi.controls');
IbwUi.controls.ComboBoxJSON = Ext.extend(Ext.form.ComboBox, {
url: '',
root: '',
valueField: 'id',
displayField: 'name',
listWidth: 200,
width: 200,
initComponent: function () {
var comboStoreJson = new Ext.data.JsonStore({
idProperty: 'id',
autoDestroy: true,
autoLoad: true,
root: this.root,
fields: this.fields || [
{ name: 'id', type: 'int' },
{ name: 'name', type: 'string' }
],
sortInfo: {
field: this.displayField,
direction: 'ASC'
},
proxy: new Ext.data.ScriptTagProxy({
api: {
read: this.url
}
})
});
var config = {
autoSelect: true,
store: comboStoreJson,
displayField: this.displayField,
valueField: this.valueField,
mode: 'remote',
forceSelection: true,
minChars: 1,
triggerAction: 'all',
lastQuery: '',
typeAhead: true,
typeAheadDelay: 50,
lazyRender: true,
lastQuery: '',
value: this.value,
listWidth: this.width + 200,
width: this.width
};
Ext.apply(this, config);
IbwUi.controls.ComboBoxJSON.superclass.initComponent(this);
this.on('beforeselect', function() {
})
}
});
Ext.reg("ibwComboJson", IbwUi.controls.ComboBoxJSON);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment