1

大多数人使用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');}
4

1 回答 1

1

如果您使用的是 extjs 3

尝试这个:

function Cal(value, metaData, rec, rowIndex, colIndex, store) {
       return rec.data.quantity + rec.data.lost;
}
于 2011-06-08T09:17:30.057 回答