开发者

Can I calculate a field directly in an Extjs grid?

开发者 https://www.devze.com 2023-03-11 09:04 出处:网络
Example table: -Field quantity-|-Field quantity loss-|----Total------| |-----2----------|-------4-------------|---total=2+4---|

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

精彩评论

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