zoukankan      html  css  js  c++  java
  • flex中使用DataGrid显示xml 之二

    1,使用了状态

    2,使用了datagrid的编辑格式,日期格式化,

    3,使用datagrid列中包含其他组件的方法 

    4,使用了xml转换ArrayCollection 

    <?xml version="1.0" encoding="utf-8"?>

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="bookDate.send()">
    <mx:states>
    <mx:State name="nr">
    <mx:AddChild position="lastChild">
    <mx:Text text="Text" width="571" height="380" id="ns" enabled="false" alpha="0.38"/>
    </mx:AddChild>
    <mx:RemoveChild target="{datagrid1}"/>
    </mx:State>
    </mx:states>
    <mx:Script>
              <![CDATA[
               import mx.messaging.channels.StreamingAMFChannel;
               import mx.controls.dataGridClasses.DataGridColumn;
                   import mx.collections.*;
                   import mx.rpc.events.*;
                   [Bindable]
                   private var bookstock:ArrayCollection;
                   private function bookHandler(evt:ResultEvent):void
                   {
                   bookstock=evt.result.NewDataSet.NewView;
                   test.dataProvider=bookstock;
                   }
                   private function dateformat(dateItem:Object,Time:DataGridColumn):String
                   {
                   return ptime.format(dateItem.Time);
                   }

             ]]>
         </mx:Script>
    <mx:HTTPService id="bookDate" url="huiyuan.xml" result="bookHandler(event)" />

    <mx:DataGrid width="474" id="test"  >
    </mx:DataGrid>
     


    <mx:DataGrid width="825.5" height="100%" dataProvider="{bookDate.lastResult.NewDataSet.NewView}"  enabled="true" id="datagrid1"  editable="true">
    <mx:columns>
    <mx:DataGridColumn headerText="序列号" dataField="id"  width="100" fontSize="14"/>
    <mx:DataGridColumn headerText="姓名" dataField="name"/>
    <mx:DataGridColumn headerText="电话" dataField="phone"/>
    <mx:DataGridColumn headerText="邮件" dataField="mail"/>
    <mx:DataGridColumn headerText="时间" dataField="Time" labelFunction="dateformat"/>
    <mx:DataGridColumn headerText="reviews" itemEditor="vtest" editable="true" >
    </mx:DataGridColumn>
    </mx:columns>
    </mx:DataGrid>
    <mx:DateFormatter id="ptime" formatString="MM YYYY" />

    <mx:Style source="fcss.css"/>
         
    </mx:Application>

  • 相关阅读:
    一本通1273货币系统(方案数背包)
    背包体积循环正序和逆序的区别
    Python字典的底层原理和优缺点
    Linux各目录及每个目录的详细介绍
    openwrt 下python程序后台运行,并将打印信息保存文件
    pycharm同一目录下无法import其他文件
    python sqlite3学习笔记
    python sqlite3查询表记录
    Pycharm快捷键的使用
    Python3 Address already in use 解决方法
  • 原文地址:https://www.cnblogs.com/fslnet/p/1848041.html
Copyright © 2011-2022 走看看