PDA

View Full Version : Superselect combobox some times populates sometime doesn't



muncher
11 Aug 2010, 10:00 AM
I have superselect comobobox and tied to an AJAX request. The Box populates by the ajax request. Good.

But now, I would want it to select only certain values from another request.

So, for the form I have defined XmlReader that returns a comma separated list of values. However, this box, now populates sometimes and sometime it doesn't.

muncher
11 Aug 2010, 10:11 AM
It looks like this..



Ext.lib.form.myForm = Ext.extend(Ext.form.Formpanel, {
constructor : function (config) {

Ext.lib.form.myForm .superclass.constructor.call(this, config);
this.items.add(new Ext.lib.form.ComboBox.MultiCombo());

},
initComponent : function(args) {
var config = {

anchor:'50%',
autoWidth:false,
width:600,
title : 'Edit',
reader : new Ext.data.XmlReader( {
.................
{name: 'supported', convert: (function(){
var contactReader = new Ext.data.XmlReader({
record: '>supported>contact',
fields: [
{name: 'Id', mapping :'id'}
]
});
return function(v, n) {
var contactArr = contactReader.readRecords(n).records;
var contactIds ="";
for (index =0; index < contactArr.length; index++) {
contactIds = contactIds + contactArr[index].data.Id + ",";
}
contactIds = contactIds.substring(0, contactIds.length-1);
return contactIds;
};
})()}]
})
};

Ext.apply(this, config);// end of Ext.apply
Ext.apply(this.initialConfig, config);
Ext.lib.form.myForm.superclass.initComponent.apply(this,
args);
...........

.............
.............
.............


//combobox
Ext.lib.form.ComboBox.MultiCombo = Ext.extend(Ext.ux.form.SuperBoxSelect, {
initComponent : function(config) {
Ext.apply(this, {
store : new Ext.lib.form.myStore(),
displayField : 'name',
displayFieldTpl: '{name}',
valueField : 'id',
name:'supported',
hiddenName : 'supported',
typeAhead : true,
mode : 'local',
fieldLabel : 'Supported List',
anchor : '70%',
forceSelection : true,
triggerAction : 'all',
emptyText : 'Select one or more contacts...',
hideOnSelect:false,
selectOnFocus : true
}); // end of ext.apply
Ext.lib.form.ComboBox.MultiCombo.superclass.initComponent.apply(
this, config);
this.getStore().load();
} // end of initcomponent
}); // end of Multi-SelectCombo