How to make mouserover on map & highlight popup datagrid

1239
3
08-26-2010 09:13 AM
by Anonymous User
Not applicable
Original User: MayMay

I am using an example at this site for hover your mouse over a state then datagrid are highlighted:
http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/02/19/Sychronizing-map-and-datagrid-intera...
but I can't get the mouseover to work on my popup datagrid window. It works fine on non datagrid popup window. 
Besides that, I am trying to get rid of multiple popup window when click on "query" button.
Hope someone can show me how to do it.  Please see my attachment files.

Thank you very much.
0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: kenbuja

To solve the multiple popup windows problem, I changed the testing code

                        //PopUp Window on DataGrid
                        var obj:Object = featureSet.attributes;
                        var myfloatdg:MyFloatDG;

                        myfloatdg = MyFloatDG(PopUpManager.createPopUp(myMap,MyFloatDG,false));
                        PopUpManager.centerPopUp(myfloatdg);                        
to this:

                        //PopUp Window on DataGrid
                        var obj:Object = featureSet.attributes;
//                        var myfloatdg:MyFloatDG;
                        if (myfloatdg == null)
                        {
                            myfloatdg = MyFloatDG(PopUpManager.createPopUp(myMap,MyFloatDG,false));    
                        }
                            
                        myfloatdg.visible = true;
                        
                        PopUpManager.centerPopUp(myfloatdg);
For the datagrid interaction, you didn't include any functions to operate the ItemRollOver and ItemRollOut events for the datagrid.  These are the changes I made to your code (which includes a change in the closeMe function to deal with the multiple popup problem)

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx=            "http://www.adobe.com/2006/mxml"
                xmlns:esri=            "http://www.esri.com/2008/ags" 
                layout=                "absolute" 
                width=                "622" 
                height=                "300"  
                showCloseButton=    "true" 
                title=              "Results"
                close=                "closeMe()">
    <mx:Script>
        <![CDATA[
            import mx.events.ListEvent;
            import com.esri.ags.geometry.Extent;
            import com.esri.ags.layers.GraphicsLayer;
            import com.esri.ags.Map;
            import mx.managers.PopUpManager;
            import com.esri.ags.Graphic;
            [Bindable] public var myMap:Map;
            [Bindable] public var myGraphicsLayer:GraphicsLayer;
            private var _data:Object;
   
            public function set graphicslayer(value:GraphicsLayer):void
            {
                myGraphicsLayer = value;
            }
            public function set dProvider(value:Object):void
            {
                _data = value;
                resultsGrid.dataProvider = _data;
            }

            public function closeMe():void
            {
                this.visible = false;
                myGraphicsLayer.clear();
            }
            
            private function onItemRollOver(event:ListEvent):void
            {
                findGraphicByAttribute(event.itemRenderer.data).symbol = highlightSymbol;
            }
            
            private function onItemRollOut(event:ListEvent): void
            {
                findGraphicByAttribute(event.itemRenderer.data).symbol = resultsSymbol;

            }
            
            private function findGraphicByAttribute( attributes : Object ) : Graphic
            {
                for each (var graphic:Graphic in myGraphicsLayer.graphicProvider)
                {
                    if (graphic.attributes == attributes)
                    {
                        return graphic;
                    }
                }
                return null;
            }
        ]]>
    </mx:Script>

        <esri:SimpleFillSymbol id="resultsSymbol" color="0x999999" alpha="0.01" style="solid">
            <esri:SimpleLineSymbol color="0x00FFFF" width="2" alpha="1" style="solid" />
        </esri:SimpleFillSymbol>
        <esri:SimpleFillSymbol id="highlightSymbol" color="0xFF0000" alpha="1" style="cross">
            <esri:SimpleLineSymbol color="0x00FFFF" width="2" alpha="1" style="solid" />
        </esri:SimpleFillSymbol>

         <mx:DataGrid id="resultsGrid"
             itemRollOver="onItemRollOver(event);" itemRollOut="onItemRollOut(event);" 
            scroll="true" width="100%" height="40%">
            <mx:columns>
            <mx:DataGridColumn id="dcg" dataField="STATE_NAME"/>
            <mx:DataGridColumn id="dcg1" dataField="POP2007"/> 
            </mx:columns>
         </mx:DataGrid> 
</mx:TitleWindow>
0 Kudos
by Anonymous User
Not applicable
Original User: MayMay

Kenbuja,
Thank you very much. You help me alot on this forum, I really appreciated that.

May
0 Kudos
varnavarna
New Contributor
Hi, I used the code of this thread to add a popup DataGrid into my application. When in the main map the DataGrid had the ability to zoom on click in it which I saw from here --> http://forums.arcgis.com/threads/10377-How-to-zoom-to-selected-record-on-Data-Grid-result?p=35685&po... (another thread from you :)) I tried to make the DataGrid in the popup to behave the same way but I guess there is something that prevents the click from the DataGrid to get to the main application. Can you tell what I'm not doing right?

Best Regards,

Deyan
0 Kudos