开发者

setting the value in a column equal to the product of two other columns in flex

I have this spark DataGrid with five c开发者_如何学Goolumns. my third and fourth columns represent amount (of product ordered) and price (of a unit of the product). My issue now is to set the fifth column equal to price*amount. I can't seem to find a way to do this. anyone? thank you.


I assume that amount and price are stored in the objects that populate your DataGrid.

Just create a custom itemRenderer for the fifth column. In the dataChange event calculate the value. Conceptually something like this:

protected function onDataChange(event:Event):void{
  myDisplayField.text = (data.amount*data.price).toString();
}

More info on creating custom renderers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜