开发者

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

开发者 https://www.devze.com 2023-04-11 18:39 出处:网络
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 co

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

精彩评论

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