0
ExtTaskManager에서 extjs 태스크를 실행하고 5 초마다 내 ext 스토어를 다시로드합니다. 작업이 호출 될 때마다 내 combobox에서 현재 선택된 인덱스 (값)를 보유하는 currentIndex 변수를 업데이트합니다. 문제는 숫자를 가져 오는 대신 currentIndex가 value [object Object]를 얻는 경우입니다. 왜 이런 일이 발생하는지 전혀 모르겠습니다. 여기 내 샘플 코드는 다음과 같습니다.콤보 박스 인덱스는 extjs의 숫자 대신 [object Object]를 얻습니다.
// combo store
var myStore = Ext.create('Ext.data.Store', {
id: store_id,
fields: ['label', 'value', 'type'],
autoLoad: true,
proxy: {
type: 'ajax',
url: '/url/to/controller',
reader: {
type: 'json',
root: 'MyModel'
}
}
}),
createWindow = function() {
var myComboBox = Ext.create('Ext.form.field.ComboBox', {
flex: 3,
editable: false,
value: 'Select option',
displayField: 'label',
valueField: 'value',
store: myStore,
cls: 'comboCssClass',
id: ComboBoxId,
listeners: {
'select': function(combo, row, index) {
var rowData = row[0].data;
currentIndex = this.getValue();
}
}
};
return newWindow = Ext.create('Ext.widget.window',{
// window settings
items:[myComboBox ]
});
},
reloadStoretask = {
run: function(){
myStore.load();
// here is where in some cases I get [object Object] instead of number
// And I think the object is Ext.data.store.ImplicitModel or it was alike.
// so currentIndex = [object Object] in some cases
record = myStore.getAt(currentIndex).data;
},
interval: 5000
}
문제를 해결하려면 어떻게해야합니까?
어디에서 myComboBox를 호출하여 실행합니까? –
불행히도 extjs 창을 만드는 별도의 함수로 만들어졌습니다. 업데이트 된 코드보기 – Vlad
오류가 발생했을 때 저장소를 채우는 데 사용되는 데이터는 무엇입니까? –