How to get the DataGridColumn Value


hi all,
have problem datagridcolumn . in "how datagridcolumn value when application loads"(here not using anyother event).
in code have 3 columns.i want first datagridcolum(name) values(all rows values).
here send code please refer ...

<?xml version="1.0"?>
<!-- datagrid control example. -->
<mx:application xmlns:mx=" http://www.adobe.com/2006/mxml" creationcomplete="init()">

<mx:script>
<![cdata[
import mx.controls.alert;
]]>
</mx:script>
<mx:xmllist id="employees">
<employee>
<name>christina coenraets</name>
<phone>555-219-2270</phone>
<email>ccoenraets@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>joanne wall</name>
<phone>555-219-2012</phone>
<email>jwall@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>maurice smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
<active>false</active>
</employee>
<employee>
<name>mary jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
<active>true</active>
</employee>
</mx:xmllist>

<mx:panel title="datagrid control example" height="100%" width="100%"
paddingtop="10" paddingleft="10" paddingright="10">

<mx:label width="100%" color="blue"
text="select row in datagrid control."/>

<mx:datagrid editable="true" id="dg" width="50%" height="60%"
itemeditend="alert.show('hi')" doubleclickenabled="true" doubleclick="dg.editable=true" rowcount="5" dataprovider="{employees}">
<mx:columns>
<mx:datagridcolumn id="nam" datafield="name" headertext="name"/>
<mx:datagridcolumn datafield="phone" headertext="phone"/>
<mx:datagridcolumn datafield="email" headertext="email"/>
</mx:columns>
</mx:datagrid>

<mx:form width="100%" height="100%">
<mx:text text="employe details" fontsize="18"/>
<mx:formitem label="name :">
<mx:label text="{dg.selecteditem.name}"/>
</mx:formitem>
<mx:formitem label="email :">
<mx:label text="{dg.selecteditem.email}"/>
</mx:formitem>
<mx:formitem label="phone :">
<mx:label text="{dg.selecteditem.phone}"/>
</mx:formitem>
</mx:form>

</mx:panel>
<mx:script>
<![cdata[

private function init():void{
var name:string=nam.datafield;
alert.show("values: "+name);
}
]]>
</mx:script>

</mx:application>


thanks in advance,
premdas.


this code may help:


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62