示例表:
|-Field quantity-|-Field quantity loss-|----Total------|
|-----2----------|-------4-------------|---total=2+4---|
|-----3----------|-------5-------------|---total=3+5---|
我可以通过 extjs 上的函数渲染它吗?
总计=田地数量+田地数量损失
是的,您必须使用网格 getColumnModel 方法。
grid.getColumnModel().setRenderer(2, function(value, metaData, record, rowIndex, colIndex, store) {
return record.get('quantity') + record.get('loss');
});
更多信息:http ://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.grid.GridPanel和
http://dev.sencha.com/deploy/ext-3.3.1/ docs/?class=Ext.grid.ColumnModel?class=Ext.grid.ColumnModel