微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flex progressbar in datagrid

Embed progressbar in datagrid 
See the code below.

The key point is <mx:itemRednderer> ... .This seqment can embed component into datagrid.

fetch data to set progressbar 
The key point is this.data["progress"]. The this.data["progress"] is the value getted from dataprovider.

trigger to update progressbar 
This key point is updateComplete handler which is called when dataprovider is refreshed. So we

can update progressbar in updateComplete callback function.

 <mx:AdvancedDataGridColumn id="progressshow" width="300" datafield="progress"
            headerText="进度">
   <mx:itemRenderer>
    <fx:Component>
     <mx:HBox creationComplete="hBox1_creationCompleteHandler(event)"
        updateComplete="hBox1_updateCompleteHandler(event)">
      <fx:Script>
       <![CDATA[
        import mx.events.FlexEvent;
        
        protected function hBox1_updateCompleteHandler(event:FlexEvent):void
        {
         if(this.data != null)
         {
          trace(this.data["progress"]);
          pd.setProgress(this.data["progress"],100);
          pd.label = "已完成" + pd.percentComplete + "%";
         }
         
        }
        
        protected function hBox1_creationCompleteHandler(event:FlexEvent):void
        {
         pd.setProgress(0,100);
         pd.label = "已完成" + pd.percentComplete + "%";
         
        }
        
       ]]>
      </fx:Script>
      <mx:ProgressBar id="pd" width="280" maximum="100" minimum="0" mode="manual">
      </mx:ProgressBar> 
     </mx:HBox>
    </fx:Component>
   </mx:itemRenderer>
   </mx:AdvancedDataGridColumn>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐