Passing a4j: function parameter

How to pass a4j: jsFunction parameter from javascript, I want to call categoryChanged and everything I put there - even an explicit String, the parameter is not displayed on the bean side.

Here is the js code:

$(function() {
    $( "#resizable" ).resizable();
    $( "#selectable" ).selectable({stop: function(event, ui) { 
        $( ".ui-selected", this ).each(function() {
            var index = $( "#selectable li" ).index( this );
            categoryChanged("Test String");
            categoryChanged(this);
            categoryChanged(ui.id);
            categoryChanged($( "#selectable li" ).value(this));
        });
        // ajax call to render the content
    }});
    $("#menu").buttonset();

});

and the definition of the function a4j:

<a4j:jsFunction name="categoryChanged"
        action="#{appexplorerbean.categoryChanged}" limitToList="true"
        oncomplete="" reRender="appexplrtable">         
<a4j:actionparam name="newCategory" />
</a4j:jsFunction>
+3
source share
1 answer

You need to assign a parameter to install.

<a4j:jsFunction name="categoryChanged"
        action="#{appexplorerbean.categoryChanged(newCategory)}" limitToList="true"
        oncomplete="" reRender="appexplrtable">         
    <a4j:actionparam name="newCategory" assignTo="#{newCategory} />
</a4j:jsFunction>

or directly set the value.

<a4j:jsFunction name="categoryChanged"
            action="#{appexplorerbean.categoryChanged}" limitToList="true"
            oncomplete="" reRender="appexplrtable">        
    <a4j:actionparam name="newCategory" assignTo="#{appexplorerbean.newCategory} />
</a4j:jsFunction>

Hope this still helps

+5
source

All Articles