1
디자이너를 사용 중입니다. 내 목표는 newBtn을 클릭하여 지금까지 시작된 상점 레코드를 업데이트하는 것입니다. 나는 그것을 호출 한 함수 밖에서 처리하려고 시도하고있다.저장 데이터를 변경할 때 extjs 업데이트
버튼을 클릭하면 작동합니다.
이 ./application.js
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
name: 'MyApp',
stores: [
'MyArrayStore'
],
launch: function() {
Ext.QuickTips.init();
var cmp1 = Ext.create('MyApp.view.TradeGrid', {
renderTo: Ext.getBody()
});
cmp1.show();
//PROBLEM HERE
// This actually does something but when maxIndex is printed to the console it = 0
// Meaning that no data has been loaded to grid
// Am I wrong thinking it should? As the other file loads two data cells right away
cmp1.addRecord([]);
//PROBLEM HERE
./TradeGrid.js
Ext.define('MyApp.view.TradeGrid', {
extend: 'MyApp.view.ui.TradeGrid',
initComponent: function() {
var me = this;
me.callParent(arguments);
var button = me.down('button[text=newBtn]');
button.on('click', me.onSubmitBtnClick, me);
},
addRecord: function(myRecordArray) {
var grid = Ext.getCmp("TradeGrid"); //defined by -> Property: id
var store = grid.getStore();
var maxIndex = store.getCount();
console.log(maxIndex); //maxIndex PRINT to CONSOLE
var res = store.insert(maxIndex, [["ll", "kk", "00"]]);
console.log(this);
},
onSubmitBtnClick: function() {
this.addRecord([]);
}
});
}
});
처음 두 데이터는 내가 볼
[
["Ace Supplies", "Emma Knauer", "555-3529"],
["Best Goods", "Joseph Kahn", "555-8797"],
]
디자이너가 생성 한 코드를 망쳐 버리는 결과를 낳았습니다. 실제로는 웹 소켓을 사용할 준비가되지 않았지만 지금 코드를 작성하는 방식으로 응답이 작동합니다. – BAR