我在表单面板内的字段集中有一个编辑器网格面板。我正在使用编辑器网格面板记录需要添加到发票记录的多个发票行项目。我需要做的是从编辑器网格面板(对于每个行项目)中获取美元金额,并将(正数)或减去(负数)添加到编辑器网格面板之外但在表单面板内的字段。此字段称为应付金额。如何才能做到这一点?谢谢您的帮助。这是表单的代码和屏幕截图。夺旗
这是网格的代码。/ ==== 发票数据开始 =========================================== ============== /
//
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]);
}
}
]
});
///////////////////