Ticket #89 (closed defect: fixed)
Search panel: incorrect parameters javascript calls
| Reported by: | pagameba | Owned by: | madair@… |
|---|---|---|---|
| Priority: | P2 | Milestone: | 1.1 |
| Component: | Widgets | Version: | 1.0.6 |
| Severity: | Major | Keywords: | |
| Cc: | External ID: | ||
| state: | Approved | Browser: | All |
| Operating System: | All |
Description
Reported by Rémy, filed in mapguide trac as:
http://trac.osgeo.org/mapguide/ticket/630
This appears to be a copy/paste error when we brought the search panel over, to be fixed in 1.0 and trunk.
--
I found a fix that worked.
First, looking at widgets/Search/Search.templ:
function CellClicked(sel)
{
var map = GetParent().Fusion.getMapByName(mapName);
map.setSelection(sel, false, true);
}
Should be changed like this to match correctly the API:
function CellClicked(sel)
{
var map = GetParent().Fusion.getMapByName(mapName);
map.setSelection(sel, true);
}
Second, the call to setSelection from map object is (lib/Map.js):
setSelection: function(selText, requery, zoomTo) {
for (var i=0; i<this.aMaps.length; i++ ) {
this.aMaps[i].setSelection(selText, requery, zoomTo);
}
}
Should be changed like this to match correctly the API:
setSelection: function(selText, zoomTo) {
for (var i=0; i<this.aMaps.length; i++ ) {
this.aMaps[i].setSelection(selText, zoomTo);
}
},
Finally, setSelection from Mapguide.js has for params:
'selection': encodeURIComponent(selText),
it's proposed to change like this:
'selection': selText,
encodeURIComponent encodes twice the params and that make the call-back error happend.
We see that setSelection has finally in Mapguide.js only 2 parameters: selText, zoomTo. But in Map.js and Search.templ it was called with 3 parameters: selText, requery, zoomTo
Quite confusing for a mistake.
Rémy
