Can I calculate a field directly in an Extjs grid?
Example table:
|-Field quantity-|-Field quantity loss-|----Total------|
|-----2----------|-------4-------------|---total=2+4---|
|-----3----------|-------5-------------|---total=3+5---|
Can I render it by function on extjs?
tot开发者_开发百科al=field quantity + Field quantity Loss
Yes, you must use the grid getColumnModel method.
grid.getColumnModel().setRenderer(2, function(value, metaData, record, rowIndex, colIndex, store) {
return record.get('quantity') + record.get('loss');
});
More info: http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.grid.GridPanel and
http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.grid.ColumnModel?class=Ext.grid.ColumnModel
精彩评论