• 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>

  • 相关阅读:
    python模块
    python函数进阶
    python函数
    六.python的深浅拷贝
    五.集合及其推导式
    IOS微信显示NAN,中国标准时间日期转换
    Caused by: org.apache.ibatis.binding.BindingException: Parameter 'XXX' not found. Available parameters are [beginTime, endTime, param3, param1, vesselName, param2] 找不到参数的解决方式
    java的nullpointerexception空指针异常,关于使用了timer定时导致service调用问题
    java设置开始时间,定时执行任务
    java多层嵌套集合的json,如何获取多层集合中所需要的value
  • 原文地址:https://www.cnblogs.com/sange/p/2412281.html
Copyright © 2020-2023  润新知