[mapguide-users] How to sort a selection set
soudemans
soudemans at ruekert-mielke.com
Fri Jan 27 16:17:41 EST 2012
Hi,
I have a select type list box "resultSelect" that is populated from a
MapGuide OSGeo selection set using the code below. While doing some testing
I noticed that the select box remained unsorted. I did some searching to
find an answer but my efforts came up empty. I tried several things
including things like results.sort() but no-go. Does anyone have any idea
how to sort the this set?
Thanks
*asp*
<select class="Ctrl" id="resultSelect" size="15"
onchange="OnResultChange()" style="width: 100%"></select>
*javascript to populate the select box*
function OnReadyStateChange()
{
var ready = queryReqHandler.readyState;
if (ready == READY_STATE_COMPLETE)
{
results = queryReqHandler.responseText.parseJSON();
var resultSelect = document.getElementById("resultSelect");
resultSelect.options.length = 0;
for (var i = 0; i < results.length; i++)
{
resultSelect.options[i] = new
Option(results[i].displayValue, i, false, false);
}
OnResultChange();
document.getElementById("executeBtn").disabled = false;
document.getElementById("busyImg").src = NOT_BUSY_IMAGE;
queryReqHandler = null;
}
}
*Javascript to capture the returned selection set "queryReqHandler"*
function ExecuteQuery()
{
reqParams = "COMMAND=<%=Command.EXECUTEQUERY%>";
reqParams += "&SESSION=" + encodeURIComponent(session);
reqParams += "&MAPNAME=" + encodeURIComponent(mapName);
reqParams += "&LAYERNAME=Sanitary%20Manholes";
reqParams += "&USEPROPERTYFILTER=true";
reqParams += "&PROPERTYNAME=MH_NO";
reqParams += "&ISSTRING=true";
reqParams += "&OPERATOR=1";
reqParams += "&VALUE=" +
encodeURIComponent(document.getElementById("valueInput").value);
reqParams += "&USESPATIALFILTER=false";
reqParams += "&OUTPUTPROPERTY=MH_NO";
reqParams += "&QUERYMAX=" +
encodeURIComponent(document.getElementById("queryMax").value);
if (msie)
queryReqHandler = new ActiveXObject("Microsoft.XMLHTTP");
else
queryReqHandler = new XMLHttpRequest();
queryReqHandler.onreadystatechange = OnReadyStateChange;
queryReqHandler.open("POST", "querycontroller.aspx", true);
queryReqHandler.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
document.getElementById("executeBtn").disabled = true;
document.getElementById("busyImg").src = BUSY_IMAGE;
queryReqHandler.send(reqParams);
}
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-sort-a-selection-set-tp4344383p4344383.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list