PDA

View Full Version : Combo Box on form load, with remote json store and pagination



cpx
26 Sep 2011, 1:45 AM
I have this combo box that i need to display the display field when the form is loading.
right now, I'm successfully loaded the form, but it's display the value field sometimes. I learn that this is due to the data in the store.

If i enter a data that is on the first page in the store, it load the display value. but if I entered value that is not on the first page it didn't show the display field but value field.

it's like the store didn't reload when the form load.

here is some relevant code i think



...
listeners:{
render: function() {
var pemeriksaan_id = this.findParentByType('PemeriksaanWindow').pemeriksaan_id;

this.anggotaForm.load({
url: 'jsp/rencana_pemeriksaan/show_action.jsp',
params: {id: pemeriksaan_id}
});



}


and the combobox ui



InputPegawaiPanelUi = Ext.extend(Ext.form.ComboBox, {
displayField: 'nama',
typeAhead: false,
loadingText: 'Searching...',
pageSize: 10,
hideTrigger:true,
anchor: '100%',
minChars: 1,
valueField: 'nip',
allowBlank:false,
forceSelection: true,
initComponent: function() {
InputPegawaiPanelUi.superclass.initComponent.call(this);
}
});


and the combo js



InputPegawaiPanel = Ext.extend(InputPegawaiPanelUi, {
initComponent: function() {
InputPegawaiPanel.superclass.initComponent.call(this);

this.store = new Ext.data.JsonStore({
root: 'data',
totalProperty: 'total',
url: 'jsp/pegawai/list_load.jsp',
autoLoad: false,
fields: [
{
name: 'nip'
},
{
name: 'nama'
}
]
});
},
searchBtnClickHandler: function(btn, e) {
document.pegawaiWindow.show();
}
});

Ext.reg('inputPegawaiPanel', InputPegawaiPanel);


is there any simple way to make the combo reload with the value field as the parameter, or should I do this manualy when loading the form ?