Hi Gilles,

On Fri, May 16, 2008 at 3:35 PM, Gilles Bassière
<[EMAIL PROTECTED]> wrote:
> I try to use the action property of a WfsGetFeature button but it doesn't
> seem to work. As a dummy test, I put this line :
> <action>window.alert('test')</action>
> in my WfsGetFeature object in config.xml. I got this syntax from the "time
> series" example. But I can't see any "test" message when I click on the
> button and FireBug reports no error.

The action property is only implemented for Button.js, which allows
you to create custom buttons quickly.

> Also, I'm not sure about the "action" approach. I need to trigger some extra
> code when the button is selected. According to the wiki page " Listeners and
> the Javascript API", I should use the action property for this : "[...]
> <action> property which specifies an object method to be called when a
> button is selected." But this is not really an event-driven approach, is it
> ? I wonder how I could make use of events to accomplish this. Any hints ?

You are right, you should work with events here. In the case of
WfsGetFeatureInfo, the features will be queried and loaded into the
model you specified in the transactionResponseModel property (e.g.
"trm").

To do your action event-based, you should say

function myAction(objRef) {
  window.alert("test");
}
config.objects["trm"].addListener("loadModel", myAction, config.objects["trm"]);

The third parameter of addListener is the context that will be passed
to the objRef parameter of the event handler. In your case, it might
be useful to pass the model itself, which will give you access to the
xml of the GetFeature response (objRef.doc).

Regards,
Andreas.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users

Reply via email to