Dear all,
In my flex application, I have a function to retrieve feature attributes in a datagrid.
In the datagrid, I add a context menu "Select and Zoom", when click this context menu on a selected row, I need to select and zoom to the feature based on the "Item No" and "Item Sub No" value.
The feature layer is a polyline layer.
I tried to find a solution from ESRI smaple, but no luck. Could anybody please give me help on this? Thanks a lot.
I am using Adobe Flash Builder 4.6 and arcgis api for flex 3.6.
Solved! Go to Solution.
Hi Robert,
You are so nice, thanks a lot. This time no fault error.
But still 2 issues:
(1) If I use the updated GetLoc() no result displayed in the datagrid.
public function GetLoc(event:ResultEvent):void {
// Databind data from webservice to datagrid
datagrid.dataProvider = new ArrayCollection(event.result as Array);
}
(2) If I use the old GetLoc function, result will display, but when I try to use "select and zoom", still the same, only the busy cursor there.
This time I use another layer and query on the Segment_ID only, the following is what can found in the querytask url.
and query.where = "Segment_ID ='1988/03-1'"; //this time use exact value to test
And what I see in manually select this feature:
But still not work. So sorry to trouble so much, but this one drive me crazy.
Li Yao,
So have you inspected the query.where string to see if it is what you are expecting by placing a breakpoint in your code or a trace like this:
query.where = "Item_No = '" + datagrid.selectedItem.itemNo + "' and Sub_No = '" + datagrid.selectedItem.subNo + "'"; trace(query.where);
Hi Robert,
Yes I trace the query statement and also verified it in arcmap.
Thanks.
Hi Robert,
Currently situation is I can confirm the query feature exists.
BUT the strange thing is in both cases(the feature exists or not exist), it always show the busy cursor.
What may be the possible reason for this problem?
Thanks for the help.
Li Yao,
The portions of your code where you are using this.cursorManager.removeBusyCursor(); are not portions that you actually use. So the the busy cursor will stay unless you put that line in some code that is actually being called.
Maybe try this code update (line 8):
var unionExtent:Extent; var myFirstGraphic:Graphic = featureSet.features[0]; unionExtent = Polyline(myFirstGraphic.geometry).extent; for each (var myGraphic1:Graphic in featureSet.features) { graphicsLayer.add(myGraphic1); if(myGraphic1.geometry !== myFirstGraphic.geometry){ unionExtent = unionExtent.union(Polyline(myGraphic1.geometry).extent); } } map.extent = unionExtent;
Thank you Robert for the help on this topic.
But the problem still there. I trace the progress and find the application stuck at this line:
unionExtent = Polyline(myFirstGraphic.geometry).extent;
And I found the code will NOT satisfy the condition of :(myGraphic1.geometry !== myFirstGraphic.geometry).
Thanks!
Li Yao,
So are you sure that myFirstGraphic.geometry is not null? Are you sure that the geometry is actually a Polyline?
Hi Robert,
Yes myFirstGraphic.geometry is not null and the geometry is polyline.
The code seems partially work now, it can zoom to the feature but not select the feature.
Is there anything missing?
Thanks a lot!!
Hi Robert,
I have 2 layers (1 polyline, 1 polygon). I use the same code (except to change polyline to polygon), it works properly (zoom to the feature, also select the feature).
Since this thread is too long, I create a new thread to make it clear. thanks.