Select an object in MapGuide 2.0.2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Select an object in MapGuide 2.0.2

alba
hi all,

I use mapguide open source 2.0.2 on Windows XP and IIS
I have to select an object after the extraction, but
I tried in three different alternative ways but  doesn't work
I use the following code.
Anyone can help me? My work is stopped!
thanks Alba


//************************************
var mapWidgetId = 'Map';
var Fusion = window.top.Fusion;
var mapWidget = Fusion.getWidgetById(mapWidgetId);

function SelectFeature(){
        ..............................
        .............................
            selectionXml = reqHandler.responseText;
            sel=TrimString(selectionXml);

           //-- first mode-----------
             var map = GetParent().Fusion.getMapByName(mapName);
             map.setSelection(sel, true, true);
            //----------------

           //-- second mode----------
            GetParent().SetSelectionXML(sel);
            //----------------

           //-- third mode----------
            mapWidget.setSelection(sel, z);
            //----------------

           alert(mapWidget.hasSelection());

        }

function SetSelectionXML(selectionXml) {
    var Fusion = window.top.Fusion;
    var mapWidget = Fusion.getWidgetById('Map');
    if (mapWidget && mapWidget.isMapLoaded()) {
        mapWidget.setSelection(selectionXml, true, true);
    }
}

  function GetParent()
  {
    if(popup) {
        return opener;
    } else {
        return parent.parent;
    }
  }

 function TrimString(responseString)
        {
            responseString = responseString.replace( /^\s+/g, "" );
            return responseString.replace( /\s+$/g, "" );
        }
//*************************************************