开发者

Passing parameter to a4j:function

开发者 https://www.devze.com 2023-03-03 14:40 出处:网络
How can I pass parameter to a4j:jsFunction from javascript, I want to call categoryChanged and whatever I put there - even explicit String, parameter is not visible on bean side.

How can I pass parameter to a4j:jsFunction from javascript, I want to call categoryChanged and whatever I put there - even explicit String, parameter is not visible on bean side.

Here is 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 th开发者_开发问答e content
    }});
    $("#menu").buttonset();

});

and a4j function definition:

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


You need to assign the parameter to set.

<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 it still helps

0

精彩评论

暂无评论...
验证码 换一张
取 消