zoukankan      html  css  js  c++  java
  • flex4.5 DataGrid 列中添加Button,事件函数中获取外部的方法、属性。

     外部的方法和属性必须用public,内部列函数用 outerDocument 获得。 

     看例子吧:

                           //更新

    public function updateData():void
    {
    _service = new RemotingConnection(_gatewayURL);
    _service.call("RemotingService.PlanConfiguration.deletePlanConfigurationData",
    new Responder(onUpdateDataResult,onFault),dgResult.selectedItem.id);
    }
    //删除
    public function delectData():void
    {
    _service = new RemotingConnection(_gatewayURL);
    _service.call("RemotingService.PlanConfiguration.deletePlanConfigurationData",
    new Responder(onDeleteDataResult,onFault),
    dgResult.selectedItem.id);

    }  

     1<s:DataGrid id="dgResult" width="100%" height="100%" dataProvider="{arr}">

     2                 <s:columns>
     3                     <s:ArrayList>                        
     4                         <s:GridColumn headerText="方案编号" dataField="id"  width="65"/>
     5                         <s:GridColumn headerText="方案名称" dataField="name"  width="65"/>
     6                         <s:GridColumn headerText="方案类型" dataField="type"  width="65"/>
     7                         <s:GridColumn headerText="标题" dataField="tittle"  width="38"/>
     8                         <s:GridColumn headerText="时间" dataField="date"  width="70"/>
     9                         <s:GridColumn headerText="地点" dataField="site"  width="38"/>
    10                         <s:GridColumn headerText="任务描述" dataField="describe"  width="65"/>
    11                         <s:GridColumn headerText="执行单位" dataField="execute_unit"  width="65"/>
    12                         <s:GridColumn headerText="协作单位" dataField="assist_unit"  width="65"/>
    13                         <s:GridColumn headerText="发送单位" dataField="send_unit"  width="65"/>
    14                         <s:GridColumn headerText="媒体附件" dataField="accessory"  width="65"/>
    15                         <s:GridColumn headerText="操作">
    16                             <s:itemRenderer>
    17                                 <fx:Component>
    18                                     <s:GridItemRenderer>
    19                                         <s:layout>
    20                                             <s:HorizontalLayout verticalAlign="middle"  />
    21                                         </s:layout>

    22                                         
    23                                         <fx:Script>
    24                                             <![CDATA[
    25                                         
    26                                                 protected function btnEide_clickHandler(event:MouseEvent):void
    27                                                 {
    28                                                     // TODO Auto-generated method stub
    29                                                     if(outerDocument.dgResult.selectedIndex != -1)
    30                                                     {
    31                                                         outerDocument.updateData();
    32                                                     }                                                    
    33                                                 }
    34                                                 
    35                                                 protected function btnDelete_clickHandler(event:MouseEvent):void
    36                                                 {
    37                                                     // TODO Auto-generated method stub
    38                                                     outerDocument.delectData();
    39                                                 }
    40                                                 
    41                                                 protected function btnPreview_clickHandler(event:MouseEvent):void
    42                                                 {
    43                                                     // TODO Auto-generated method stub
    44                                                     outerDocument.previewData();
    45                                                 }
    46                                                 
    47                                             ]]>
    48                                         </fx:Script>
    49                                         
    50                                         <s:Button id="btnEide" label="编辑" click="btnEide_clickHandler(event)" />
    51                                         <s:Button id="btnDelete" label="删除" click="btnDelete_clickHandler(event)" />
    52                                         <s:Button id="btnPreview" label="预览" click="btnPreview_clickHandler(event)" />
    53                                     </s:GridItemRenderer>  
    54                                 </fx:Component>
    55                             </s:itemRenderer>
    56                         </s:GridColumn>
    57                     </s:ArrayList>                        
    58                 </s:columns>
    59             </s:DataGrid>

  • 相关阅读:
    线性代数学习路线
    补充.关于秩的不等式
    第十讲.无关性、基与维数
    第九讲.Ax = b
    第八讲.Ax = 0
    大三下学期第一个月反思
    第六讲.LU分解
    第五讲.矩阵的逆
    第四讲.矩阵的运算
    NAT 实验
  • 原文地址:https://www.cnblogs.com/sange/p/2412281.html
Copyright © 2011-2022 走看看