zoukankan      html  css  js  c++  java
  • flex查询xml字段绑定DataGrid小结

     flex查询xml字段绑定DataGrid小结
     1. xml定义
       [Bindable]
      private var xmlitems:XML=
      <Data>
        <item id=”1″>
          <Province>浙江</Province>
          <County>杭州</County>
          <Zipcode>310012</Zipcode>
          <Areacode>0571</Areacode>
        </item>
          <item id=”2″>
          <Province>浙江</Province>
          <County>温州</County>
          <Zipcode>325000</Zipcode>
          <Areacode>0577</Areacode>
        </item>
      </Data>

    2.DataGrid绑定如下
         <mx:DataGrid id=”Show” height=”100%” width=”474″ >
       <mx:columns>
                   <mx:Array>
                       <mx:DataGridColumn dataField=”Province” headerText=”省份”/>
                       <mx:DataGridColumn dataField=”County” headerText=”地区”/>
                       <mx:DataGridColumn dataField=”Zipcode” headerText=”邮编”/>
                       <mx:DataGridColumn dataField=”Areacode” headerText=”区号”/>
                   </mx:Array>
              </mx:columns>
      </mx:DataGrid>
    3.
    绑定全部<mx:DataGrid id=”Show” height=”100%” width=”474″ dataProvider=”{xmlitems.item}” >
    根据id查询      <mx:DataGrid id=”Show” height=”100%” width=”474″ dataProvider=”{xmlitems.item.(@id==2)}” >
    如果想按Zipcode邮编字段查询<mx:DataGrid id=”Show” height=”100%” width=”474″ dataProvider=”{xmlitems.item.(Zipcode==325000)}” >
    总结注意 dataProvider里面区别结合xml,
    另外如果<mx:DataGrid id=”Show” height=”100%” width=”474″ dataProvider=”{xmlitems.item.(County==杭州)}” >,用字符的话这样会出现杭州未定义,
    暂时不知道如何直接改,替代方法是用as方法在 定义个后再赋值,下次弄好把完整查询发出来

    本文http://www.ajaxcn.net首发

  • 相关阅读:
    ACMer第7天Falling Ants
    贪心初步-FatMouse' Trade
    贪心初步-A
    ACM集训第二天
    asp.net中遍历套用母版页的页面的控件
    a 标签中调用js的几种方法
    笔记
    html控件和web控件
    ASP.NET中GUID类
    (转)常见邮件服务器(接收服务器和发送邮件服务器)地址
  • 原文地址:https://www.cnblogs.com/sendling/p/1539675.html
Copyright © 2011-2022 走看看