Flex Mobile / FindTask & SplitViewNavigator

851
11
Jump to solution
08-05-2013 10:29 AM
KomanDiabate
New Contributor III
Hello All,
I trying to build flex moblile app where I am using  splitNavigator to display a query and map result on two separte views. I am using the findTask to query the data however, I am having some problems displaying the query results on the map view.

On the findTask executeComplete event I am running the executeCompleteHandler event using the pushView method to push the graphics to the map, but nothing is being display:

private function executeCompleteHandler(event:FindEvent):void {    var resultCount:int = event.findResults.length;   if (resultCount == 0)   {    //do something   }   else   {    // add feature as graphic to graphics layer    for (var i:int = 0; i < resultCount; i++)    {     findTaskResults.addItem(event.findResults.feature)     }       var snv:SplitViewNavigator=navigator.parentNavigator as SplitViewNavigator;   var mapView:ViewNavigator=snv.getViewNavigatorAt(1) as ViewNavigator;    mapView.pushView(map, findTaskResults); }      } 


On the map view, I trying to load the data in the following manner, but I getting an error on the graphic layer dataprovider
{data.feature}.

<esri:GraphicsLayer graphicProvider="{data.feature}" >    <esri:symbol>     <esri:SimpleFillSymbol alpha="0.5" color="red">      <esri:outline>       <esri:SimpleLineSymbol alpha="1.0" color="yellow"/>      </esri:outline>     </esri:SimpleFillSymbol>    </esri:symbol>   </esri:GraphicsLayer>


Any help will be appreciated.

Thanks all.

Koman Diabate
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Koman,

   Glad to help, now you can do your parts by marking this thread as answered:

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:

View solution in original post

0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus
Koman,

   It appears that your findTaskReuslts is an ArrayCollection, so if that is the case than it has no ideas what data.feature is.

try using:

<esri:GraphicsLayer graphicProvider="{data}" >


as what you are pushing to the view is just an ArrayCollection.
0 Kudos
KomanDiabate
New Contributor III
Hi Robert,
I have actually tried <esri:GraphicsLayer graphicProvider="{data}" >
but I didn't see any graphics displayed on the map. I am debugging the resultCount value from the executeCompleteHandler(event)
it's returning a 0 value, my findTask maybe not be running the query properly. I will debug this some more to pinpoint the source of the problem.
Thanks for your help.

Koman D.
0 Kudos
KomanDiabate
New Contributor III
Hi Robert,
I have reworked my findTask and simplify the logic, now I am getting a results in the executecompleteHandler but the graphics is still not being displaying on the. Not sure what I am doing wrong.
Help Please....
protected function button1_clickHandler(event:MouseEvent):void
{
            // TODO Auto-generated method stub
              findTask.execute(myFindParams);
}
   
private function executeCompleteHandler2(event:FindEvent):void
{
 var snv:SplitViewNavigator=navigator.parentNavigator as SplitViewNavigator;
              var mapView:ViewNavigator=snv.getViewNavigatorAt(1) as ViewNavigator;
 zx.text = "Found " + event.findResults.length + " results.";
 mapView.pushView(map, event.findResults);
}
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Koman,

   You got to read your documentation more. The type returned by a FindEvent.findResults is an Array of FindResults... Not an Array of Graphics. You are going to have to process the find results and get to each of the one of their feature properties which is an actual graphic and add that to an ArrayCollection to act as a graphics provider.
0 Kudos
KomanDiabate
New Contributor III
Ooopps.
I am finally seeing graphics. Forgot to follow all the way through with the logic.
I initially was looping through the findResult and adding them to my findTaskResult arraycollection, but I was having problem with my findTask, so I didn't get the result I was looking for.
Looked at the code again, made some changes and  I am seeing graphics again,  Yay....
Thanks for helping.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Koman,

   Glad to help, now you can do your parts by marking this thread as answered:

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:

0 Kudos
KomanDiabate
New Contributor III
Considere it done.

One thing that is bugging me now is the transition, it doesn't work well for map-centric apps. I am trying to get rid of using:
mapView.pushView(map, findTaskResults, null, null); but it not working for me. Any hints?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Koman,

  I am not big into Mobile development so I don't have a suggestion there.
0 Kudos
KomanDiabate
New Contributor III
Thanks, I appreciate that.
Good Day..
0 Kudos