Flex spark. components. DataGrid and MX. Controls. DataGrid specify data and item click events

Source: Internet
Author: User

Bonding data of spark. components. DataGrid

 

<s:DataGrid id="yinji" x="0" y="-21" width="100%" height="397"       dataProvider="{CaseData}"       selectionChange="yinjiDG_itemClickHandler(event)" textAlign="left">     <s:columns>         <s:ArrayList>       <s:GridColumn dataField="EmergencyName" headerText=""  sortable="false" />        </s:ArrayList>                </s:columns>         </s:DataGrid>
public var _X:int;public var _Y:int;private function yinjiDG_itemClickHandler(event:GridSelectionEvent):void{_X = event.currentTarget.dataProvider[event.selectionChange.rowIndex].Longitude;_Y = event.currentTarget.dataProvider[event.selectionChange.rowIndex].Latitude;var PointID:String = event.currentTarget.dataProvider[event.selectionChange.rowIndex].EmergencyCaseID;var arrpoint:Array = new Array();if(_X != 0 && _X.toString() != "NaN" && _Y != 0 && _Y.toString() != "NaN"){arrpoint.push(_X);arrpoint.push(_Y);arrpoint.push(PointID);arrpoint.push("case");AppEvent.dispatch(AppEvent.TOPOINT,arrpoint)}}

MX. Controls. DataGrid's bonding data

 <mx:DataGrid>    <mx:dataProvider>        <mx:Object Artist="Pavement" Price="11.99"          Album="Slanted and Enchanted"/>        <mx:Object Artist="Pavement"          Album="Brighten the Corners" Price="11.99"/>    </mx:dataProvider>    <mx:columns>        <mx:DataGridColumn dataField="Album"/>        <mx:DataGridColumn dataField="Price"/>    </mx:columns>  </mx:DataGrid>
public var _X:int;public var _Y:int;
protected function yinji_itemClickHandler(event:ListEvent):void{try{var _X:Number = event.itemRenderer.data.Longitude;    var _Y:Number = event.itemRenderer.data.Latitude;       var arrpoint:Array = new Array();   if(_X != 0 && _X.toString() != "NaN" && _Y != 0 && _Y.toString() != "NaN"){     var PointID:String = event.itemRenderer.data.GeoNo;    arrpoint.push(_X);     arrpoint.push(_Y);     arrpoint.push(PointID);     arrpoint.push("Geo");     AppEvent.dispatch(AppEvent.TOPOINT,arrpoint)    }
}catch(e:Error){trace(e.toString());} }

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.