[Cartoweb-users] ajax and custom plugIn

Oliver Christen oliver.christen at camptocamp.com
Mon Mar 17 10:18:02 EDT 2008


To work with ajax, a plugin needs :

in php ClientYourpugin.php:

ajaxGetPluginResponse(..) to return the templates via ajax
ajaxHandleAction(..) to react to actions sent via ajax

in javascript Yourpugin.ajax.js

AjaxPlugins.Yourpugin = {

handleResponse: function(pluginOutput) {
... // to handle the template returned via ajax, you usualy call the 
AjaxHandler.updateDomElement function to place the template at the right 
place
}

}

AjaxPlugins.Yourpugin.Actions = {};

AjaxPlugins.Yourpugin.Actions.Someaction = {

    // this is an action called from a button or javascript link in your 
template, usualy with an onclick="return 
CartoWeb.trigger('Yourpugin.Someaction', 'doSubmit()');"

    buildPostRequest: function(argObject) {
        return AjaxHandler.buildPostRequest(); // unless you want to return 
some specific variable
    }
}

look at plugin Outline, it has all these functions

regards
Oliver

>
> Hi,
> the ajax support is very interesting. I've developed a set of plugIn in
> cartoweb 3.2, without ajax.
> I'd like to rewrite these plugIns so they have the ajax support.
> What is the starting point ? THat is, I studied some examples out of
> cartoweb, but I don't understand how I can link the ajax carto support 
> with
> my template of plugin.
> Is there anyone who can show me the "first step"?
>
> thanks and best regards
>
> Giu
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Scopri le tue passioni con Leonardo.it!
>
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7655&d=20080317
>
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list