清风的blog 优然探索

数据表格控件DataGrid

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

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

 

    <mx:XMLList id="books">

        <book>

            <name>AJAX经典案例开发大全</name>

            <price>52.80</price>

            <ISBN>9787302154105</ISBN>

        </book>

        <book>

            <name>PHP网络编程从入门到精通</name>

            <price>59.80</price>

            <ISBN>9787302154129</ISBN>

        </book>

        <book>

            <name>DREAMWEAVER网页设计与制作完全手册</name>

            <price>59.80</price>

            <ISBN>9787302154112</ISBN>

        </book>

        <book>

            <name>JSP网络编程从入门到精通</name>

            <price>62.00</price>

            <ISBN>9787302147107</ISBN>

        </book>

    </mx:XMLList>

 

    <mx:Panel title="数据格栅示例" height="50%" width="50%"

        paddingTop="10" paddingLeft="10" paddingRight="10">

 

         <mx:DataGrid id="dg" width="100%" height="50%" rowCount="5" dataProvider="{books}">

            <mx:columns>

                <mx:DataGridColumn dataField="price" headerText="价格"/>

                <mx:DataGridColumn dataField="name" headerText="书名"/>

                <mx:DataGridColumn dataField="ISBN" headerText="ISBN"/>

             </mx:columns>

        </mx:DataGrid>

 

        <mx:Form width="100%" height="50%">

            <mx:FormItem label="书名">

                <mx:Label text="{dg.selectedItem.name}"/>

            </mx:FormItem>

            <mx:FormItem label="价格">

                <mx:Label text="{dg.selectedItem.price}"/>

            </mx:FormItem>          

            <mx:FormItem label="ISBN">

                <mx:Label text="{dg.selectedItem.ISBN}"/>

            </mx:FormItem>

       </mx:Form>

       

    </mx:Panel>

</mx:Application>
2010年2月19日 | 发布:admin | 分类:Flex | 评论:0

发表留言: