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>

  • 相关阅读:
    React在componentDidMount里面发送请求
    React 术语词汇表
    React里受控与非受控组件
    React和Vue等框架什么时候操作DOM
    【LeetCode】79. Word Search
    【LeetCode】91. Decode Ways
    【LeetCode】80. Remove Duplicates from Sorted Array II (2 solutions)
    【LeetCode】1. Two Sum
    【LeetCode】141. Linked List Cycle (2 solutions)
    【LeetCode】120. Triangle (3 solutions)
  • 原文地址:https://www.cnblogs.com/fslnet/p/1848041.html
Copyright © 2011-2022 走看看