开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜