Gad*_*lin 3 javascript jsf ajax4jsf
我如何从javascript传递参数到a4j:jsFunction,我想调用categoryChanged和我放在那里的任何东西 - 甚至显式的String,参数在bean端是不可见的.
这是js代码:
$(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();
});
Run Code Online (Sandbox Code Playgroud)
和a4j函数定义:
<a4j:jsFunction name="categoryChanged"
action="#{appexplorerbean.categoryChanged}" limitToList="true"
oncomplete="" reRender="appexplrtable">
<a4j:actionparam name="newCategory" />
</a4j:jsFunction>
Run Code Online (Sandbox Code Playgroud)
小智 5
您需要指定要设置的参数.
<a4j:jsFunction name="categoryChanged"
action="#{appexplorerbean.categoryChanged(newCategory)}" limitToList="true"
oncomplete="" reRender="appexplrtable">
<a4j:actionparam name="newCategory" assignTo="#{newCategory} />
</a4j:jsFunction>
Run Code Online (Sandbox Code Playgroud)
或直接设置值.
<a4j:jsFunction name="categoryChanged"
action="#{appexplorerbean.categoryChanged}" limitToList="true"
oncomplete="" reRender="appexplrtable">
<a4j:actionparam name="newCategory" assignTo="#{appexplorerbean.newCategory} />
</a4j:jsFunction>
Run Code Online (Sandbox Code Playgroud)
希望它仍然有帮助
| 归档时间: |
|
| 查看次数: |
5696 次 |
| 最近记录: |