Javascript (client evaluated) parameter functionality

UI Components for JSF
Post Reply
ezequielf
Posts: 3
Joined: 07 Feb 2011, 00:11

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:

Code: Select all

<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" />
And call somewhere in the page to:

Code: Select all

PrimeFaces.ajax.AjaxRequest(url, {source:'remoteCommandID',...}, {'paramname1':javascript_value_param,...});
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:

Code: Select all

<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" >
  <p:param name="someName" type="client" />
</p:remoteCommand>
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:
<script type="text/javascript">
function remoteCommandName(arg1){
PrimeFaces.ajax.AjaxRequest(url, {source:'remotepepe', ...'},{'someName':arg1});
}
</script>
I know this means changind org.primefaces.renderkit.CoreRenderer.buildAjaxRequest (...) to consider different classes of parameters.

Thanks in advance, the components are really good and easy to use.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests