PDA

View Full Version : Any idea please ???


Anitha
04-08-2008, 12:31 PM
Hi all,

I have one problem in my project.Any idea plz??

For my project, I have created one MXML component based on panel.That panel contains one View stack container which contains the two childs named chartVBox and grid VBox.And also I have one toggle buttonbar .The dataprovider property of togglebuttonbar is the viewstack.

Here I retrive all the results from my asp.net webservice with some selectionperiod query.
I am afraid that you cant understand my design.Please refer my source.I hope that will help you to understand.


<mx:ViewStack id="vs" width="100%" height="100%">

<mx:VBox id="chartVBox" icon="@Embed('icon_chart.png')">
<mx:LineChart id="chart" width="100%" height="100%">
--------
</mx:VBox>

<mx:VBox id= "gridVBox" icon="@Embed('icon_grid.png')">
<mx:DataGrid id="grid" width="100%" height="100%">
--------
</mx:VBox>
</mx:ViewStack>

<mx:ControlBar height="37">
<mx:ToggleButtonBar dataProvider="{vs}" id="toggle"/>
</mx:ControlBar>


Everything Ok.But when I select my selectionperiod, the results displayed in my chartVBox successfully. When I click the togglebutton to change my view mode to gridVBox,the results not shown.

//My script is,

private function remotingHandler(event:ResultEvent):void
{
var answer:ArrayCollection = event.result.Tables ["annualresult"].Rows;
var ans:Array=ArrayUtil.toArray(answer);
chart.dataProvider=answer;
grid.dataProvider=answer; // I think,in this step I miss something //
}


//How can I retrieve the same result in my second gridVBox with the same results in my First chartVBox [My first chartVBox works successfully]. Any idea please??


Anitha.

Anitha
04-08-2008, 12:36 PM
Hi all,

I have one problem in my project.Any idea plz??

Here iam using flex3.For my project, I have created one MXML component based on panel.That panel contains one View stack container which contains the two childs named chartVBox and grid VBox.And also I have one toggle buttonbar .The dataprovider property of togglebuttonbar is the viewstack.

Here I retrive all the results from my asp.net webservice with some selectionperiod query.
I am afraid that you cant understand my design.Please refer my source.I hope that will help you to understand.


<mx:ViewStack id="vs" width="100%" height="100%">

<mx:VBox id="chartVBox" icon="@Embed('icon_chart.png')">
<mx:LineChart id="chart" width="100%" height="100%">
--------
</mx:VBox>

<mx:VBox id= "gridVBox" icon="@Embed('icon_grid.png')">
<mx:DataGrid id="grid" width="100%" height="100%">
--------
</mx:VBox>
</mx:ViewStack>

<mx:ControlBar height="37">
<mx:ToggleButtonBar dataProvider="{vs}" id="toggle"/>
</mx:ControlBar>


Everything Ok.But when I select my selectionperiod, the results displayed in my chartVBox successfully. When I click the togglebutton to change my view mode to gridVBox,the results not shown.

//My script is,

private function remotingHandler(event:ResultEvent):void
{
var answer:ArrayCollection = event.result.Tables["annualresult"].Rows;
var ans:Array=ArrayUtil.toArray(answer);
chart.dataProvider=answer;
grid.dataProvider=answer; // I think,in this step I miss something //
}


//How can I retrieve the same result in my second gridVBox with the same results in my First chartVBox [My first chartVBox works successfully]. Any idea please??


Anitha.

lemonizer
04-08-2008, 05:51 PM
Your problem is most likely caused by the fact that the 2nd child in your viewstack has not been created yet when you do this:

grid.dataProvider=answer;

The first time you change the view, flex will create the 2nd child. Try toggling the view first before you get the data from your webservice, I'm sure it'll work. Of course, that's not a good solution :P

try this:

<mx:ViewStack id="vs" creationPolicy="all" width="100%" height="100%">

<mx:VBox id="chartVBox" icon="@Embed('icon_chart.png')">
<mx:LineChart id="chart" width="100%" height="100%">
--------
</mx:VBox>

<mx:VBox id= "gridVBox" icon="@Embed('icon_grid.png')">
<mxataGrid id="grid" width="100%" height="100%">
--------
</mx:VBox>
</mx:ViewStack>

kahuja
04-08-2008, 08:33 PM
I do not recommend to set the "creationPolicy=all" as that is not the best way to do it.

Where and how are you calling the "remotingHandler"?

Anitha
04-09-2008, 05:07 AM
Wow i got answer,Thanks for your reply lemonizer.

Anitha
04-09-2008, 05:08 AM
Hi kahuja, thanks for you reply.Now i got answer by just changing my result event.