外部的方法和属性必须用public,内部列函数用
outerDocument 获得。
看例子吧:
//更新
}
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>