0 Replies Latest reply on Aug 28, 2008 10:32 PM by premadas

    Datagrid

    premadas
      Hi All,
      i'm new to flex.I have a problem with DataGrid.I displayed the data in datagrid by using xml file.In my XML file containes photo,name,email,phno are there.Whatever data is there in xml file that data i displayed in the grid but what i want is "If email id is there in xml file then i have to display the checkbox in the column of email in grid otherwise empty column".How to do that one.

      Here i will send my code both XML and MXML files:--

      MXML file:-
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      backgroundColor="white" fontSize="12" pageTitle="InviteGuests" initialize="jason.send()">
      <mx:Text x="20" y="10" text="InviteGuests" fontSize="18"/>

      <mx:HTTPService id="jason" url="JasonFriends.xml"/>
      <mx:Panel title="SelectGuest">
      <!--Start Tabs and DataGrid for Select Guests-->
      <mx:TabNavigator>

      <mx:VBox label="Jason's Friends">
      <mx:DataGrid id="select" dataProvider="{jason.lastResult.inviteguests.contact}">
      <mx:columns>
      <mx:DataGridColumn width="20">
      <mx:itemRenderer>
      <mx:Component>
      <mx:CheckBox/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn headerText="Name">
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox>
      <mx:Image source="{data.photo}" />
      <mx:Text text="{data.name}"/>
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn >
      <!--<mx:DataGridColumn dataField="name" headerText="Name"/>-->
      <mx:DataGridColumn dataField="email" headerText="Email" width="130"/>
      <mx:DataGridColumn dataField="phno" headerText="SMS" width="90"/>
      <mx:DataGridColumn dataField="phno" headerText="Call" width="90"/>
      <mx:DataGridColumn dataField="evite" headerText="eVite" width="50"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:VBox>
      </mx:TabNavigator>
      </mx:Panel>
      </mx:Application>

      and XML file:-

      <?xml version="1.0" encoding="UTF-8"?>
      <inviteguests>
      <contact>
      <photo>images/Johny.jpg</photo>
      <name>Bharath</name>
      <email>ekumar@edinc.in</email>
      <phno>9739450243</phno>
      <evite>""</evite>
      </contact>
      <contact>
      <photo>images/Jacques.jpg</photo>
      <name>Sankar</name>
      <email></email>
      <phno>9916712975</phno>
      <evite>""</evite>
      </contact>

      </inviteguests>