[Chameleon] Query widget to display only "selectedLayers"

McGraw, Joanne mcgrawj at AGR.GC.CA
Tue Aug 23 13:05:52 EDT 2005


Hello,

Me again; different problem.

My application is supposed to have functionality to Query all layers and
to Query only the currently selected layers as well (set using the
SelectLayers widget). The results of these queries are displayed in an
IFrame, whose name is passed in through the iframename attribute. 

In order to do this, I altered the Query widget:

1. To optionally accept another attribute indicating that only the
selectedLayers' values should be displayed and set the NavCommand based
on that: $this->SetNavCommand("QUERY_SELECTED"); // vs. "QUERY" for all
layers

2. In GetJavascriptInitFunctions, I am registering a new event id:
$aResult['NLWISQuerySelectedRegisterEvent'] =
"goEventManager.registerEventID( 'ON_QUERY_SELECTED' );\n";

3. In GetJavascriptFunctions, I have essentially duplicated the two
Javascript functions NLWISQueryWMouseClick and NLWISQueryWMouseMove to
create two new Javascript functions NLWISQuerySelectedWMouseClick and
NLWISQuerySelectedWMouseMove.

a. The NLWISQuerySelectedWMouseMove function checks that the NAV_CMD
equals "QUERY_SELECTED" and then sets the mouseup event to the new
function: "document.onmouseup = NLWISQuerySelectedWMouseClick;" 

b. The NLWISQuerySelectedWMouseClick appends the selected layers to the
URLs provided: "&selectedLayers=" +
{$this->mszHTMLForm}.SELECTED_LAYERS.value (so those values are
available to the Query's PHTML) and triggers the "ON_QUERY_SELECTED"
event: goEventManager.triggerEvent( 'ON_QUERY_SELECTED', nX, nY );


Now, to my problem.

I click on the NavButton to indicate that I would like to Query Selected
Layers only and click on the map. More often than not, the mouseup event
does not trigger the running of the NLWISQuerySelectedWMouseClick
function. It will occasionally; and, when it does, the results displayed
in the iframe are correct. It's just that there doesn't seem to be any
rhyme or reason to when it decides to run the function and when not.

I've tried clicking a specific numbers of times, on specific parts of
the map, using single and double-clicks, clicking once and waiting a
minute (in case there's some weird lag time happening). There does not
appear to be any pattern to when the function runs and when it doesn't.
It seems as though the mouseup event is somehow erroneous 90% of the
time and is being consumed before it actually calls the
NLWISQuerySelectedWMouseClick function.

The same Query widget works exactly as expected, on every click, when I
am not trying to limit the query to only those selected. 

Is there a piece to this puzzle that I am missing somewhere? Is there
something else I need to add to my code or to Chameleon to get this to
go?

Cheers,
jtm




More information about the Chameleon mailing list