@Sangeeta Kalyani
<mx:DataGrid id="gendg" "{inbox.lastResult.inbox.mailrecord}"
width="517" rowCount="10" height="60%"
x="30" y="29"/>
did u miss something above accidentally? actually the code below works
gracefully
<mx:DataGrid id="gendg"
dataProvider="{inbox.lastResult.inbox.mailrecord}"
width="517" rowCount="10" height="60%"
x="30" y="29"/>
what i was trying was changing dataprovider to datagrid at the click
of button.
@shavinee
Thanks a ton for the explanation.your explanation is simplest ive seen
and trickled into my head directly.thank you very much.ill soon try
and let you know how it worked.
As a workaround i used tabbed navigator and found a temporary
solution.
On Apr 12, 11:02 am, shavinee <[email protected]> wrote:
> Hi sreenidhi b.s,
>
> This statement is wrong 'gendg.dataProvider =
> "{inbox.lastResult.inbox.mailrecord}" ; '
>
> This is not the way to bind the data in flex.
> There are two ways in which u can Bind the data .
>
> 1. using AS3 (scripting) using "mx.binding.utils.BindingUtils" class
> http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtil...
>
> 2. using mxml through "{}"
> <mx:Label text="{someData}" />
>
> Now coming to your sample code . U can make it work in many ways
> one of the suggestion from my side is as follows .
>
> 1. modify your mx:HTTPService Object to include result and fault
> listeners and attach methods to them
>
> <mx:HTTPService id="inbox" resultFormat="e4x" url="Data.xml"
> showBusyCursor="true"
> result="showResult(event)" fault="showFault(event)" />
>
> 2. define your Listeners function for the Object .
>
> private function initDataGridData():void
> {
> dgpanel.title="Inbox";
> inbox.send();
> }
>
> //listener Function For result
> private function showResult(event:ResultEvent) :void {
> // this listener will be called when result comes and
> then u access the required data u wanted to display
> gendg.dataProvider = inbox.lastResult.inbox.label;
> }
>
> // listener function for fault
> private function showFault(event:FaultEvent) :void {
> Alert.show('Fault : '+ event.fault);
> }
>
> 3. In the this sample code i have used xml to load data . u can use
> your "inboxflex.jsp" .
> as you have not mentioned the type of data u are accessing from the
> jsp file . i m assuming it to be xml .
>
> <Data>
> <inbox>
> <label>ABC</label>
> <label>ABC2</label>
> . . . . . . . . . . .. . . . .
> </inbox>
> </Data>
>
> Hope this gives you some idea of binding and solution to your
> problem .
>
> Regards ,
> Shavinee
>
> On Apr 10, 11:49 pm, "sreenidhi b.s" <[email protected]> wrote:
>
> > Hi
> > i wanted to know the exact method of initializing dataprovider to datagrid
> > is external function.
> > ?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
> > <mx:Script>
> > <![CDATA[
> > private function initDataGridData():void
> > {
> > dgpanel.title="Inbox";
> > gendg.dataProvider = "{inbox.lastResult.inbox.mailrecord}"; ////is
> > this the right way? cos its not working
> > inbox.send();
> > }
>
> > ]]>
> > </mx:Script>
>
> > <mx:HTTPService id="inbox" url="inboxflex.jsp" showBusyCursor="true"/>
>
> > <mx:Button x="16" y="69" label="Inbox" width="78.5"
> > click="{initDataGridData()}" />
> > <mx:Panel id="dgpanel" x="113" y="34" width="597" height="255"
> > layout="absolute">
> > <mx:DataGrid id="gendg" width="517" rowCount="10" height="60%"
> > x="30" y="29"/>
> > </mx:Panel>
>
> > </mx:Application>
--
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.