PDA

View Full Version : How to use Basic math of the templatecolumn?



manlsea
23 Jul 2012, 6:57 PM
columns: [{ text: 'SN', xtype: 'rownumberer', width: 26 },
{ text: 'SPEC', dataIndex: 'spec'},
{ text: 'Certificate', dataIndex: 'certificate' },
{ text: 'Manual Price',xtype: 'numbercolumn', dataIndex: 'bookprice'},
{ text: 'Quantity(W)',xtype: 'numbercolumn', dataIndex: 'quantity' },
{ text: 'Transaction Price', xtype: 'numbercolumn',dataIndex: 'price'},
{ text: 'Amount',xtype: 'templatecolumn',tpl: '{quantity} * {price}'}],


fields: [
{ name: 'id', type: 'int' },
{ name: 'spec', type: 'int'},
{ name: 'certificate', type: 'string'},
{ name: 'bookprice', type: 'float'},
{ name: 'quantity', type: 'int' },
{ name: 'price', type: 'float'}],


Displayed in the cell: 1000*0.7; Is an expression.
How to make templates to do the calculation?

skirtle
23 Jul 2012, 7:58 PM
Try:


tpl: '{[values.quantity * values.price]}'