大多数人使用gridSummary插件求和值。但我想自己使用代码句柄求和并放入summaryRenderer,我的总字段是按字段数量添加的,字段丢失所以是一个空白字段。我是extjs的新手。
示例表:
|-**Field quantity**-|-**Field quantity loss**-|----**Total**------|
|-------2------------|----------4----------------|-------6---------|
|-------3------------|----------5----------------|--------8--------|
|--Bottom total:---|----------9------------------|--------14-------|
这是我的代码:
{ header: "Field quantity", width: 100, renderer: format2Dec, dataIndex: 'quantity', align: 'right', summaryType: 'sum' },
{ header: "Field quantity loss", width: 100, renderer: format2Dec, dataIndex: 'lost', align: 'right', summaryType: 'sum' },
{ header: "total", dataIndex: '', renderer: Cal, width: 100, align: 'right', css: 'background-color:#f2f1da !important;', summaryRenderer: total}
function Cal(value, metaData, record, rowIndex, colIndex, store,total) {
total = record.get('quantity') + record.get('lost');}