• DataGrid-1


    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   minWidth="955" minHeight="600">
        <fx:Declarations>
            <!-- 将非可视元素(例如服务、值对象)放在此处 -->
        </fx:Declarations>
        
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                //绑定表格用的数据    
                [Bindable]
                private var arr:ArrayCollection = new ArrayCollection([
                    {neName:"教工路文一路路口相机_4", neType:"相机" , neAlarmType:"设备告警" , removeStatus:"未清除" , confirmStatus:"未确认" , neAlarmGrade:"2级"},
                    {neName:"学院路文一路路口相机_3", neType:"相机" , neAlarmType:"环境告警" , removeStatus:"未清除" , confirmStatus:"未确认" , neAlarmGrade:"3级"},
                    {neName:"文一路莫干山路路口相机_1", neType:"相机" , neAlarmType:"连接通信告警" , removeStatus:"未清除" , confirmStatus:"未确认" , neAlarmGrade:"1级"},
                    {neName:"文一路莫干山路路口相机_3", neType:"相机" ,  neAlarmType:"性能告警" , removeStatus:"未清除" , confirmStatus:"未确认" , neAlarmGrade:"4级"}
                ]);    
                
                //删除告警信息
                public function deleteAlarmRecord():void{
                    arr.removeItemAt(alarmGrid.selectedIndex);
                }
                //确认告警信息
                public function confirmAlarmInfo():void{
                    arr.getItemAt(alarmGrid.selectedIndex).confirmStatus = "已确认";
                    alarmGrid.dataProvider = arr;
                }
            ]]>
        </fx:Script>
        
    
        <s:DataGrid id="alarmGrid" width="600" height="285" dataProvider="{arr}" requestedRowCount="4" textAlign="center">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn dataField="neName" headerRenderer="Renderer.SparkDGHeadCenter" headerText="名称"></s:GridColumn>
                    <s:GridColumn dataField="neType" headerText="类型" headerRenderer="Renderer.SparkDGHeadCenter"></s:GridColumn>
                    <s:GridColumn dataField="removeStatus" headerText="清除状态" headerRenderer="Renderer.SparkDGHeadCenter"></s:GridColumn>
                    <s:GridColumn dataField="confirmStatus" headerText="确认状态" headerRenderer="Renderer.SparkDGHeadCenter"></s:GridColumn>
                    <s:GridColumn headerText="操作">
                        <s:itemRenderer>
                            <fx:Component>
                                <s:GridItemRenderer>
                                    <s:HGroup> 
                                        <mx:LinkButton label="清除"
                                                       click="outerDocument.deleteAlarmRecord();"
                                                       color="#2066CF" fontWeight="normal"
                                                       textDecoration="underline" toolTip="清除"/> 
                                        <mx:LinkButton label="确认"
                                                       click="outerDocument.confirmAlarmInfo()"
                                                       color="#2066CF" fontWeight="normal"
                                                       textDecoration="underline" toolTip="确认"/> 
                                    </s:HGroup>
                                </s:GridItemRenderer>
                                
                            </fx:Component>
                        </s:itemRenderer>
                    </s:GridColumn>
                </s:ArrayList>
            </s:columns>
        </s:DataGrid>
        
    </s:Application>
  • 相关阅读:
    我的第九个java程序--spring和mybatis整合(java project)
    php 批量插入字段
    php 遍历静态html成文章列表
    把world转成html
    java 读取world的图片 并把图片路径存入数据库
    我的第八个java程序--读取word内容
    我的第7个java程序--把java web项目改为java project项目--mybatis
    我的第六个java程序 spring-bean
    学习spring2--跟我一起学Spring 3(3)–使用Spring开发第一个HelloWorld应用
    学习spring1--跟我一起学Spring 3(2)–开发环境配置
  • 原文地址:https://www.cnblogs.com/cai-yigo/p/3534591.html
Copyright © 2020-2023  润新知