Display XML 2 using DataGrid In Flex

Source: Internet
Author: User
1. The status is used.

2. The DataGrid editing format and date format are used,

3. Use the DataGrid column to include other components

4. xml conversion is used.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 )" /> & Lt; 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 = "Serial Number" datafield = "ID" width = "100" fontsize = "14"/> <Mx: datagridcolumn headertext = "name" datafield = "name"/> <Mx: datagridcolumn headertext = "phone" datafield = "phone"/> <Mx: datagridcolumn headertext = "mail" datafield = "mail"/> <Mx: datagridcolumn headertext = "time" 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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.