[mapguide-users] SetSelectionXML from opener

Jamo adam.jamison at portbris.com.au
Wed May 6 01:08:04 EDT 2009


I'm using opener.parent.mapFrame.SetSelectionXML(XML) to set the selection of
the map from a search window.

It selects one feature as requested, on the right layer .... however none of
the properties pane is updated correctly?

.... does the XML have to contain the properties as well??

this is the part that does the work

while (cFeats.ReadNext())
          {
            //MgSelection cSel = new MgSelection();
            MgPropertyCollection idProps = new MgPropertyCollection();
            foreach (MgPropertyDefinition IDPropDef in
cFeats.GetClassDefinition().GetIdentityProperties())
            {
              idProps.Add(new MgInt32Property(IDPropDef.Name,
cFeats.GetInt32(IDPropDef.Name)));
            }
            MgSelection cSel = new MgSelection();
            cSel.AddFeatureIds(cLayer, cLayer.GetClassName(), idProps);

            String selText =
System.Web.HttpUtility.HtmlEncode(cSel.ToXml());
            //
            Response.Write(selText);
            TableRow TR = new TableRow();
            if (cFeats.IsNull("StaffMember") == false)
            {
              TableCell TC = new TableCell();
              TC.Text = "a HREF=\"#\" onclicker=\"sendXML('" + selText +
"');\">" + cFeats.GetString("StaffMember") + " ";//onclick changed to
onclicker
              TR.Cells.Add(TC);
            }
            if (cFeats.IsNull("Infotitle") == false)
            {
              TableCell TC = new TableCell();
              TC.Text = cFeats.GetString("Infotitle");
              TR.Cells.Add(TC);
            }
            if (cFeats.IsNull("InfomailNickname") == false)
            {
              TableCell TC = new TableCell();
              Image displayImage = new Image();
              displayImage.ImageUrl =
"http://intranet/Image%20Library/Staff%20Photos/" +
cFeats.GetString("InfomailNickname") + ".jpg";
              displayImage.Height = 70;
              TC.Controls.Add(displayImage);
              TR.Cells.Add(TC);
            }
            SearchResults.Rows.Add(TR);
          }


and the Javascript

function sendXML(XML)
{
 // if(parent.parent.mapFrame = null)
 // {
 alert(opener.parent.mapFrame.name);
    opener.parent.mapFrame.SetSelectionXML(XML);
 // }
}   
-- 
View this message in context: http://n2.nabble.com/SetSelectionXML-from-opener-tp2808645p2808645.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list