PDA

View Full Version : Combobox RawValue Blank After Dynamic BindStore



arivwd
14 Dec 2014, 8:54 PM
i got this method



privGenerateComboLain: function(chart, cmbAsal) {
var windowModal = chart.up('window');
var toolbarNya = windowModal.down('toolbar');
var comboLain = toolbarNya.down('combobox:nth-child(3)');
var keyNya = cmbAsal.getValue();


Ext.define('comboLainModel', {
extend: 'Ext.data.Model',
fields: [{
name: keyNya
}]
});
comboLainStore = Ext.create('Ext.data.Store', {
model: 'comboLainModel',
proxy: {
type: 'ajax',
url: '/service/get/data/tna/2',
reader: {
type: 'json',
root: 'records'
}
},
autoLoad: false
});
comboLainStore.load({
params: { 'selectOnly': keyNya },
callback: function() {
comboLain.displayField = keyNya;
comboLain.valueField = keyNya;
comboLain.bindStore(comboLainStore);
}
});
},


The Goal is:
Everytime i change the second combo, it generate the third combo, with its own valueField and displayField.

The problem is :
First time change event in second combo work as expected, and time after that (when comboLainStore (store in third combo) loaded), the rawValue (of third combo) is always empty (but the displayField and valueField is there). The redbox combobox is ComboLain (third combo), where the previous combobox, had an event to call privGenerateComboLain method.

51278

Is it legal to change the displayField and the valueField on the fly before/after load the related store? How to display records in the third combo?
Please make my day....

arivwd
14 Dec 2014, 9:42 PM
I just solved it with :



comboLain.clearValue();
comboLain.displayField = keyNya;
comboLain.valueField = keyNya;
comboLain.displayTpl = new Ext.XTemplate(
'<tpl for=".">' +
'{[typeof values === "string" ? values : values["' + comboLain.displayField + '"]]}' +
'<tpl if="xindex < xcount">' + comboLain.delimiter + '</tpl>' +
'</tpl>'
);
comboLain.picker = null;


Thanks for reading...