hi Ravi i have one doubt i have an xml
<root> <data> <time datas="Hello" > <john second="one"></john> <michel></michel> </time> </data> </root> can i make "datas" as header text and "second" as cell data with the above itemrenderer and mxml any idea -- Karthik.k Mobile - +91-9894991640 On Wed, Jun 10, 2009 at 2:15 PM, Karthik K <[email protected]> wrote: > Hi Ravi > > Thank you > > -- > Karthik.k > Mobile - +91-9894991640 > > On Wed, Jun 10, 2009 at 2:08 PM, Ravi Mishra <[email protected]>wrote: > >> >> Hi Karthik, >> >> use this external itemRenderer on your datagrid column >> >> package com.renderer >> { >> import mx.containers.HBox; >> import mx.containers.VBox; >> import mx.controls.Alert; >> import mx.controls.Text; >> public class TimeRenderer extends VBox >> { >> public function TimeRenderer() >> { >> super(); >> } >> >> override public function set data(value:Object):void >> { >> super.data=value; >> var listXml:XMLList = data..time; >> for each(var node:XML in listXml){ >> var hb:HBox = new HBox(); >> var timeText:Text = new Text(); >> timeText.text = no...@datas; >> >> hb.addChild(timeText); >> var secondText:Text = new Text(); >> secondText.text = no...@second; >> hb.addChild(secondText); >> this.addChild(hb); >> >> } >> >> >> } >> } >> } >> >> >> Put this file in the relevant package and reference it as itemRenderer >> in datagrid column. It works with me :) >> >> -Ravi >> On Jun 10, 12:35 pm, Karthik K <[email protected]> wrote: >> > hi >> > >> > below is my code >> > >> > <?xml version="1.0" encoding="utf-8"?> >> > <mx:Application width="500" height="200" >> > xmlns:mx="http://www.adobe.com/2006/mxml" >> > xmlns:components="com.pfp.components.*" >> > layout="absolute" creationComplete="init()" >> > viewSourceURL="srcview/index.html"> >> > <mx:Script> >> > <![CDATA[ >> > import mx.controls.dataGridClasses.DataGridColumn; >> > import mx.rpc.events.ResultEvent; >> > import com.adobe.viewsource.ViewSource; >> > >> > [Bindable] >> > private var xmlUrl:String="xml/classes.xml"; >> > >> > private function updateData(event:ResultEvent):void >> > { >> > classesDG.dataProvider = >> > XML(event.result).descendants("data"); >> > } >> > >> > private function init():void >> > { >> > /* xmlUrl = Application.application.parameters.xmlUrl; >> > var srcUrl:String = Application.application.parameters.srcUrl; >> > if(srcUrl) >> > ViewSource.addMenuItem(this, srcUrl); */ >> > >> > classService.send() >> > } >> > private function myLabelFunc(item:Object, >> > column:DataGridColumn):String >> > { >> > return item.xschedu...@xphysician >> +"\n"+item.xschedu...@xlastname; >> > /* if (item.address.number==undefined) >> > {return null;} >> > else >> > {return item.address.number + "\n" + >> item.address.street;} >> > */ >> > } >> > ]]> >> > </mx:Script> >> > <mx:HTTPService id="classService" url="checkData.xml" >> > result="updateData(event)" resultFormat="e4x" /> >> > <mx:DataGrid id="classesDG" width="100%" height="100%" > >> > <mx:columns> >> > <mx:DataGridColumn headerText="Data" > >> > <mx:itemRenderer> >> > <mx:Component> >> > <mx:HBox> >> > <mx:Script> >> > <![CDATA[ >> > override public function set >> > data(value:Object):void >> > { >> > super.data=value; >> > >> > //trace("xlastName",data.xschedu...@xlastname); >> > >> > //trace("xactivity",data.xschedu...@xactivity); >> > >> > } >> > >> > ]]> >> > </mx:Script> >> > <mx:Text text="{data.ti...@datas}" >> > visible="true"/> >> > <mx:Text text="{data.ti...@second}" >> > visible="true"/> >> > </mx:HBox> >> > </mx:Component> >> > </mx:itemRenderer> >> > </mx:DataGridColumn> >> > </mx:columns> >> > </mx:DataGrid> >> > </mx:Application> >> > >> > -- >> > Karthik.k >> > Mobile - +91-9894991640 >> > >> > On Wed, Jun 10, 2009 at 12:50 PM, Ravi Mishra <[email protected] >> >wrote: >> > >> > >> > >> > > Hi Karthik, >> > >> > > Can you share your code? >> > >> > > -Ravi >> > >> > > On Jun 10, 11:58 am, Karthik K <[email protected]> wrote: >> > > > Hi Ravi >> > >> > > > Thank you >> > > > i wrote Itemrenderer and got the data i have another doubt >> > >> > > > <root> >> > > > <data> >> > > > <time datas="Hello" second="one">08:00</time><time datas="Hello" >> > > > second="two">08:00</time> >> > > > <john>08:15 Sick Call,08:25 Lung Problem,08:30 Kidney Problem</john> >> > > > <michel>08:15 Sick Call,</michel> >> > > > </data> >> > > > <data> >> > > > <time datas="John" second="Bye">09:00</time> >> > > > <john>09:15 Sick Call,</john> >> > > > <michel>09:25 Lung Problem,09:15 Sick Call,09:30 Kidney >> Problem</michel> >> > > > </data> >> > > > </root> >> > >> > > > inside data node you can see in red two "time" node when i access >> this it >> > > is >> > > > not displaying one below the other it is coming continuously >> > >> > > > it is displaying as >> > >> > > > HelloHello onetwo >> > >> > > > but i need as >> > >> > > > Hello one >> > > > Hello two >> > >> > > > inside one cell >> > >> > > > any idea >> > >> > > > -- >> > > > Karthik.k >> > > > Mobile - +91-9894991640 >> > >> > > > On Tue, Jun 9, 2009 at 6:35 PM, Ravi Mishra <[email protected] >> > >> > > wrote: >> > >> > > > > I think yes!! >> > >> > > > > You have to use itemrenderers and there you cat get hold of the >> 'item' >> > > > > object and then you can parse through it. >> > >> > > > > -Ravi >> > >> > > > > On Jun 9, 4:46 pm, Karthik K <[email protected]> wrote: >> > > > > > hi Ravi >> > >> > > > > > i have one doubt >> > > > > > if my xml is >> > >> > > > > > <root> >> > > > > > <data> >> > > > > > <time datas="Hello" second="Karthik">08:00</time> >> > > > > > <john>08:15 Sick Call,08:25 Lung Problem,08:30 Kidney >> Problem</john> >> > > > > > <michel>08:15 Sick Call,</michel> >> > > > > > </data> >> > > > > > <data> >> > > > > > <time datas="John" second="Bye">09:00</time> >> > > > > > <john>09:15 Sick Call,</john> >> > > > > > <michel>09:25 Lung Problem,09:15 Sick Call,09:30 Kidney >> > > Problem</michel> >> > > > > > </data> >> > > > > > </root> >> > >> > > > > > and >> > >> > > > > > can i get "datas" and "second" in same cell >> > >> > > > > > means not in different column and not in same cell >> > >> > > > > > can i get in one cell one below the other >> > >> > > > > > any idea >> > >> > > > > > -- >> > > > > > Karthik.k >> > > > > > Mobile - +91-9894991640 >> > >> > > > > > On Mon, Jun 8, 2009 at 5:45 PM, Karthik K < >> [email protected]> >> > > > > wrote: >> > > > > > > Hi ravi >> > >> > > > > > > Thank you i got it >> > >> > > > > > > -- >> > > > > > > Karthik.k >> > > > > > > Mobile - +91-9894991640 >> > >> > > > > > > On Mon, Jun 8, 2009 at 5:17 PM, xelf <[email protected]> >> > > wrote: >> > >> > > > > > >> Hi Karthik, >> > > > > > >> Give te dataprovider as "myXML.data.time" and datafield as >> @data. >> > > > > > >> I hope this will work >> > >> > > > > > >> On Jun 8, 4:15 pm, Karthik K <[email protected]> >> wrote: >> > > > > > >> > Hi ravi >> > >> > > > > > >> > but how to get this >> > >> > > > > > >> > <mx:DataGridColumn dataField="@datas"/> >> > >> > > > > > >> > from >> > >> > > > > > >> > <root> >> > > > > > >> > <data> >> > > > > > >> > <time datas="Hello">08:00</time> >> > > > > > >> > <john>08:15 Sick Call,08:25 Lung Problem,08:30 Kidney >> > > Problem</john> >> > > > > > >> > <michel>08:15 Sick Call,</michel> >> > > > > > >> > </data> >> > > > > > >> > <data> >> > > > > > >> > <time datas="John">09:00</time> >> > > > > > >> > <john>09:15 Sick Call,</john> >> > > > > > >> > <michel>09:25 Lung Problem,09:15 Sick Call,09:30 Kidney >> > > > > Problem</michel> >> > > > > > >> > </data> >> > > > > > >> > </root> >> > >> > > > > > >> > -- >> > > > > > >> > Karthik.k >> > > > > > >> > Mobile - +91-9894991640 >> > >> > > > > > >> > On Mon, Jun 8, 2009 at 4:04 PM, Ravi Mishra < >> > > [email protected] >> > >> > > > > > >> wrote: >> > >> > > > > > >> > > i think it should be getData.lastResult.data >> > >> > > > > > >> > > But I am not sure as my FlexBuilder crashed today :( >> Just try >> > > > > that >> > > > > > >> > > out. >> > >> > > > > > >> > > -Ravi >> > >> > > > > > >> > > On Jun 8, 3:19 pm, Karthik K <[email protected]> >> wrote: >> > > > > > >> > > > hi ravi >> > >> > > > > > >> > > > see my code >> > >> > > > > > >> > > > checkData.xml >> > >> > > > > > >> > > > <root> >> > > > > > >> > > > <data> >> > > > > > >> > > > <time datas="Hello">08:00</time> >> > > > > > >> > > > <john>08:15 Sick Call,08:25 Lung Problem,08:30 Kidney >> > > > > Problem</john> >> > > > > > >> > > > <michel>08:15 Sick Call,</michel> >> > > > > > >> > > > </data> >> > > > > > >> > > > <data> >> > > > > > >> > > > <time datas="John">09:00</time> >> > > > > > >> > > > <john>09:15 Sick Call,</john> >> > > > > > >> > > > <michel>09:25 Lung Problem,09:15 Sick Call,09:30 Kidney >> > > > > > >> Problem</michel> >> > > > > > >> > > > </data> >> > > > > > >> > > > </root> >> > >> > > > > > >> > > > <mx:HTTPService url="checkData.xml" id="getData" >> > > > > > >> resultFormat="e4x"/> >> > > > > > >> > > > <mx:VBox> >> > > > > > >> > > > <mx:DataGrid id="dgSource" >> > > > > > >> dataProvider="{getData.lastResult.root.data}" >> > > > > > >> > > > editable="true" > >> > > > > > >> > > > <mx:columns> >> > > > > > >> > > > <mx:DataGridColumn dataField="time" /> >> > > > > > >> > > > </mx:columns> >> > > > > > >> > > > </mx:DataGrid> >> > >> > > > > > >> > > > what is the problem >> > >> > > > > > >> > > > -- >> > > > > > >> > > > Karthik.k >> > > > > > >> > > > Mobile - +91-9894991640 >> > >> > > > > > >> > > > On Mon, Jun 8, 2009 at 2:47 PM, Ravi Mishra < >> > > > > [email protected] >> > >> > > > > > >> > > wrote: >> > >> > > > > > >> > > > > you can do the same '@' even if you are accessing the >> XML >> > > > > using >> > > > > > >> > > > > HttpService. Just set the resultFormat of HttpService >> to >> > > e4x >> > > > > and >> > > > > > >> take >> > > > > > >> > > > > the result in an XML variable. >> > >> > > > > > >> > > > > HTH, >> > >> > > > > > >> > > > > -Ravi >> > >> > > > > > >> > > > > On Jun 8, 1:50 pm, Karthik K < >> [email protected]> >> > > wrote: >> > > > > > >> > > > > > hi guys >> > >> > > > > > >> > > > > > this is my sample.xml >> > >> > > > > > >> > > > > > <collection> >> > > > > > >> > > > > > <object type="student"> >> > > > > > >> > > > > > <datas type="student" code="0000002303" >> > > > > name="GRIFFIN" >> > > > > > >> /> >> > > > > > >> > > > > > <datas type="student" code="0000007749" >> > > > > name="OVERTON" >> > > > > > >> /> >> > > > > > >> > > > > > <datas type="student" code="0000002486" >> > > > > name="THOMAS >> > > > > > >> III" >> > > > > > >> > > /> >> > > > > > >> > > > > > </object> >> > > > > > >> > > > > > </collection> >> > >> > > > > > >> > > > > > i need to access "type" in object and "type" in >> datas >> > > and >> > > > > pass >> > > > > > >> to >> > > > > > >> > > > > datagrid >> > >> > > > > > >> > > > > > is there any sample >> > >> > > > > > >> > > > > > i know we can use @symbol if every thing inside >> mxml >> > > page >> > >> > > > > > >> > > > > > but my xml is accessed through http service >> > >> > > > > > >> > > > > > any help >> > >> > > > > > >> > > > > > -- >> > > > > > >> > > > > > Karthik.k >> > > > > > >> > > > > > Mobile - +91-9894991640 >> > >> > >> >> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

