フォーム パネル内にあるフィールド セット内にエディター グリッド パネルがあります。エディター グリッド パネルを使用して、請求書レコードに追加する必要がある複数の請求書品目を記録しています。私がする必要があるのは、エディタ グリッド パネルから (各項目ごとに) 金額を取得し、エディタ グリッド パネルの外側でフォーム パネル内のフィールドに加算 (正の数) または減算 (負の数) することです。このフィールドは未払い額と呼ばれます。これはどのように行うことができますか?助けてくれてありがとう。フォームのコードとスクリーン ショットを次に示します。旗を取れ
グリッドのコードは次のとおりです。/ ==== 請求書データ開始 ========================================== ============= /
//
var clinRec = new Ext.data.Record.create([
{
name: 'value' ,
mapping: 'name' ,
type: 'string'
}
,{
name: 'display' ,
mapping: 'value' ,
type: 'string'
}
,{
name: 'stateRegion' ,
mapping: 'field1' ,
type: 'string'
}
,{
name: 'clinDesc' ,
mapping: 'field2' ,
type: 'string'
}
,{
name: 'fiscalYearStart' ,
mapping: 'field3' ,
type: 'string'
}
,{
name: 'declarationDate' ,
mapping: 'field4' ,
type: 'string'
}
]);
var clinReader = new Ext.data.JsonReader({
totalProperty: 'numrows',
root:'rows',
id: 'value'
},
clinRec
);
var clinStore = new Ext.data.Store({
url: 'GetPickListDataAction.do',
reader: clinReader,
listeners: {
loadexception: function(proxy, store, response, e) {
logger.trace('#####TOA:DATA: Load Exception');
}
}
});
clinStore.load({
waitTitle: 'Please Wait',
waitMsg: 'Loading...',
params: {
listType: 'CLIN'
},
callback: function (records, options, success) {
if (success) {
logger.trace("###>>TOA:DATA:CLIN:STORE:LOAD: Succeded");
}
else {
logger.trace("###>>>>>>TOA:DATA:CLIN:STORE:LOAD: failed");
Ext.MessageBox.show ({
msg: 'No records are available (CLIN)',
icon: Ext.MessageBox.WARNING,
buttons: Ext.MessageBox.OK
});
}
//Core.MessageHandler.display (dstrReader);
}
});
var iLineItemCM = new Ext.grid.ColumnModel([
{
id: 'i_line_item_clin',
header: "Field",
sortable: false,
width: 150,
editor: new Ext.form.ComboBox({
triggerAction: 'all',
valueNotFoundText: 'Select a Field...',
//emptyText: 'Select Field...',
editable: false,
forceSelection: false,
valueField: 'value',
displayField: 'display',
store: clinStore,
mode: 'local'
})
},
{
id:'i_line_item_name',
header: "Line Item Name",
dataIndex: 'i_line_item_name',
width: 315,
resizable: true,
align: 'left',
editor: new Ext.form.TextArea({
allowBlank: false
})
}
,{
header: "Amount",
dataIndex: 'i_line_item_amt',
width: 80,
align: 'right',
renderer: 'usMoney',
editor: new Ext.form.NumberField({
allowBlank: false,
allowNegative: false,
maxValue: 100000
})
}
]);
var iLineItemRec =
new Ext.data.Record.create([
{
name: 'i_line_item_name' ,
mapping: 'i_line_item_name' ,
type: 'string'
}
,{
name: 'i_line_item_amt' ,
mapping: 'i_line_item_amt' ,
type: 'string'
}
]);
var iLineItemStore = new Ext.data.Store({
url: '',
reader: new Ext.data.JsonReader({
root: 'rows'
},
iLineItemRec
)
});
var iLineItemGrid = new Ext.grid.EditorGridPanel({
id: 'iLineItemStore',
store: iLineItemStore,
cm: iLineItemCM,
cls: 'iLineItemGrid',
width: 'auto',
height: 'auto',
frame: true,
//title:'Edit Plants?',
//plugins:checkColumn,
clicksToEdit:1,
viewConfig: {
//forceFit: true
autoFit:true
},
tbar: [{
text: 'Add',
tooltip:'Add the line item',
handler : function(){
var r = new iLineItemRec({
i_line_item_name: '',
i_line_item_amt: ''
});
iLineItemGrid.stopEditing();
iLineItemStore.insert(0, r);
iLineItemGrid.startEditing(0, 0);
}
},
{
text: 'Delete',
tooltip:'Remove the selected line item',
handler: function(){
iLineItemGrid.stopEditing();
var r = iLineItemGrid.getSelectionModel().getSelectedCell();
iLineItemStore.removeAt(r[1]);
}
}
]
});
///////////////////