Exactly. I'm needing initialize a value in the velocity environment and use it
on the javascript code. it not needs to be dinamic.
I am trying to use the following code but the JS variable is returning
"undefined"
Java Script Code
var param;
this.param="$xcontext.macro.params.parameter";
console.log(param);
Velocity (Macro)
$xcontext.put("param", $xcontext.macro.params.parameter)
Some light?
ty
Atenciosamente,
Eduardo Abritta
e-mail: [email protected] |
> Date: Tue, 13 May 2014 10:05:17 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [xwiki-users] Using parameter macro in the js extension
>
> Hi,
>
>
> 2014-05-13 8:40 GMT+02:00 Michael Bußler <[email protected]>:
>
> > Hi, the velocity-code is executed on the server, while js-code runs on the
> > client side, AFTER the macro-code was executed .
> > You could try need to pass parameters to your macro via an URL parameter or
> > http POST.
> >
>
> Only if value needs to be refreshed without a page refresh. If value comes
> from a velocity macro, it's in the context of a page, so it's enough to
> initialize the javascript var from velocity (which is ok as velocity is
> executed before) - it's not supposed to be updated server-side after the
> page is rendered.
> Of course if it needs to be dynamic you could go ajax.
> Well my understanding of Eduardo is that he needs to initialize a value in
> javascript, based on a macro parameter passed to a velocity macro.
>
>
> >
> > Hope this helps!
> >
> > Best, Michael
> > Am 12.05.2014 19:01 schrieb "Eduardo Abritta" <[email protected]
> > >:
> >
> > > Hi Sirs,
> > >
> > > I am developing a macro in velocity (wiki macro) and need to use a
> > > parameter (wiki macro parameter) defined by the user in my java script
> > code
> > > (java script extension). I tried can several methods but it is not
> > working.
> > >
> > > How can I do this?
> > >
> > >
> > >
> > >
> > > Atenciosamente,
> > > Eduardo Abritta
> > > e-mail: [email protected] |
> > >
> > >
> > >
> > > _______________________________________________
> > > users mailing list
> > > [email protected]
> > > http://lists.xwiki.org/mailman/listinfo/users
> > >
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/users
> >
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users