Search Flex Components Free

Custom Search

December 20, 2007

Flex Control DataGrid Non-editable Column Source Code Sample

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="" backgroundAlpha="0" creationComplete="srv.send()" >
import mx.controls.DataGrid; import;
private function initDataGrid() : void { myGrid.dataProvider = srv.lastResult.catalog.product; }
private function verifyEdit(event:DataGridEvent) : void { if(event.dataField == 'price') { event.preventDefault(); } }
<mx:HTTPService id="srv" url="../assets/catalog.xml" useProxy="false" result="initDataGrid()"/>
<mx:Text width="550" text="In this example, although the Datagrid is editable, we are using the itemEditBeginning event to prevent the editing of the 'Price' column." />
<mx:Text id="text1" width="200" color="0xFF0000" />
<mx:DataGrid id="myGrid" editable="true" width="450" height="300" itemEditBeginning="verifyEdit(event)" > <mx:columns> <mx:DataGridColumn dataField="price" headerText="Price (non-editable)"/> <mx:DataGridColumn dataField="name" headerText="Product" /> </mx:columns></mx:DataGrid>

Related Flex Tutorials