Javascript (client evaluated) parameter functionality
Posted: 07 Feb 2011, 01:09
Hello,
I have the following problem, I need to
1)make an ajax call to the server from javascript,
2)pass some dynamic javascript parameters and
3)execute an action method,
Using remoteCommand, the only option I found is:
And call somewhere in the page to:
Since calling the rendered function (remoteCommandName()) does not send the parameter I want.
Using f:param does not result in what I need, since the parameter is computed statically.
Is weird or against the design to ask for something like:
where p:param is a new component, and its attribute type="client" indicates that the parameter should be rendered specially (to be evaluated on the client), something like:
Thanks in advance, the components are really good and easy to use.
I have the following problem, I need to
1)make an ajax call to the server from javascript,
2)pass some dynamic javascript parameters and
3)execute an action method,
Using remoteCommand, the only option I found is:
Code: Select all
<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" />
Code: Select all
PrimeFaces.ajax.AjaxRequest(url, {source:'remoteCommandID',...}, {'paramname1':javascript_value_param,...});
Using f:param does not result in what I need, since the parameter is computed statically.
Is weird or against the design to ask for something like:
Code: Select all
<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" >
<p:param name="someName" type="client" />
</p:remoteCommand>
I know this means changind org.primefaces.renderkit.CoreRenderer.buildAjaxRequest (...) to consider different classes of parameters.<script type="text/javascript">
function remoteCommandName(arg1){
PrimeFaces.ajax.AjaxRequest(url, {source:'remotepepe', ...'},{'someName':arg1});
}
</script>
Thanks in advance, the components are really good and easy to use.