Code:
Ext.ns('Ext.ux');
//start of factory function
Ext.ux.CarterRemoteCombo = function(config) {
return new Ext.ux.form.ComboBoxAdd(Ext.apply({
name: 'SiteID',
fieldLabel: this.name,
hiddenName: this.name,
displayField: 'lookupname',
originalwhere: 'this.name',
valueField: 'lookupid',
moegalReturnid: 'this.valueField',
comboVarname: 'tblbillboard_siteID',
allowBlank: false,
forceSelection: true,
//pageSize:50,
listWidth: 300,
triggerAction: 'all',
typeAhead:true,
minChars: 3,
//mode: 'remote', defaults at remote
lazyInit: false,
//hideTrigger1: false, combo defaults at false
//hideTrigger2: false, clear defaults at false
hideTrigger3: true, //search
//hideTrigger4: false, add defaults at false
listeners: {
collapse: function(combo) {
if(this.startValue != this.getValue()){
UpdateDependentComboboxStore('this.comboVarname',this.getValue(),'this.name',5,'this.mode');
console.log(this.name);
console.log(this.getValue());
}
add: function(this) {
loadwindow('Add Site','includes/table-insert.asp',true,'tableID=5&refreshType=combo&refreshID=tblbillboard_siteID',false);
},
lookup: function() {
loadwindow('Search Site','includes/table-search.asp',true,'tableID=5&refreshType=combo&refreshID=tblbillboard_siteID&linktableID=&linkID='+this.store.baseParams.LinkID,true);
},
render: function(this) {
this.store.add(new Ext.data.Record({this.valueField:'40', this.displayField:'4000/4001CPA', linkedid:''}));
this.setValue(40);
UpdateDependentComboboxStore('this.comvoVarname',40,'this.name',5,'this.mode');
}
}
store: new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'includes/get-comboremote.asp',
method: 'post'
}),
totalProperty: 'RecordCount',
autoLoad: false,
baseParams: {linkedid: "", allowNew: "true", allowSearch: "false", table: "tblsite", idname: "this.name", displayfield: "sitename", linkTableID: "", orderby: "this.name asc", where: "this.name", lookupID: 40},
fields:['this.valueField', 'this.displayField', 'linkedid'],
id: 'this.valueField',
root: 'Records',
listeners: {
load: function() {
if (this.startValue != ''){
if(this.store.find('this.valueField',this.startValue) != '-1'){
this.setValue(this.startValue);
UpdateDependentComboboxStore('this.comboVarname',this.getValue(),'this.name',5,'this.mode');
}
}
}
}
})
},
}, config));
};
Ext.reg('carterremotecombo', Ext.ux.CarterRemoteCombo);
any insight is appreciated