How to pass int or Integer parameter in <pe:remoteCommand>
Posted: 03 Jan 2017, 09:11
Hello,
recently I will use <pe:remoteCommand> to pass 2 parameters: 1 String and 1 int or Integer
The xhtml code I use FIRST is
and Javascript code that activate this widget is
The code of the function called on server is
When I use these codes, Web Application crash because there is mismatch for passing iCounter variable !
Since I found no solution; I have replaced Integer type by String type.
The new code is
and Javascript code that activate this widget is
The code of the function called on server is
This work but is not very beautiful
My question is: How to pass Integer parameter in <pe:remoteCommand> ?
recently I will use <pe:remoteCommand> to pass 2 parameters: 1 String and 1 int or Integer
The xhtml code I use FIRST is
Code: Select all
<pe:remoteCommand
name="updateFilterCounter"
process="@this"
actionListener="#{alignmentManagerController.updateFilterCounter}"
>
<pe:methodSignature parameters="java.lang.String, java.lang.Integer"/>
<pe:methodParam name="name"/>
<pe:methodParam name="counter"/>
</pe:remoteCommand>
Code: Select all
<script language='javascript'>
function afterFilter(oItem)
{
...
var sWidgetVarName = "ColorNameWidget";
var oWidgetVar = PF(sWidgetVarName);
var iCounter = oWidgetVar.inputs.filter(':checked').length;
updateFilterCounter(sWidgetVarName,iCounter);
}
</script>
Code: Select all
public void updateFilterCounter(String name, Integer counter)
{
if (false);
else if (name.equals("RegulationFilter"))
{
iRegulationFilterNrChecked = counter;
}
Since I found no solution; I have replaced Integer type by String type.
The new code is
Code: Select all
<pe:remoteCommand
name="updateFilterCounter"
process="@this"
actionListener="#{alignmentManagerController.updateFilterCounter}"
>
<pe:methodSignature parameters="java.lang.String, java.lang.String"/>
<pe:methodParam name="name"/>
<pe:methodParam name="counter"/>
</pe:remoteCommand>
Code: Select all
<script language='javascript'>
function afterFilter(oItem)
{
...
var sWidgetVarName = "ColorNameWidget";
var oWidgetVar = PF(sWidgetVarName);
var iCounter = oWidgetVar.inputs.filter(':checked').length;
updateFilterCounter(sWidgetVarName,iCounter.toString());
}
</script>
Code: Select all
public void updateFilterCounter(String name, String counter)
{
int iCounter = Integer.parseInt(counter);
if (false);
else if (name.equals("RegulationFilter"))
{
iRegulationFilterNrChecked = iCounter;
}
My question is: How to pass Integer parameter in <pe:remoteCommand> ?