Grails 如何在GSP中将表单参数从formRemote传递到remoteFunction
这个例子很简单 选择两个搜索条件并返回带有分页的表,整个页面将不会刷新 因此,我使用GrailsFormRemote提交表单,该控件返回带有模板的性别,效果很好。但是,分页我想使用Jquery,但是我无法使用formRemote中的onSuccess方法将formRemote参数传递给remoteFunction 这是代码:Grails 如何在GSP中将表单参数从formRemote传递到remoteFunction,grails,gsp,Grails,Gsp,这个例子很简单 选择两个搜索条件并返回带有分页的表,整个页面将不会刷新 因此,我使用GrailsFormRemote提交表单,该控件返回带有模板的性别,效果很好。但是,分页我想使用Jquery,但是我无法使用formRemote中的onSuccess方法将formRemote参数传递给remoteFunction 这是代码: <div class="formSep col-md-12"> <g:formRemote update="sea
<div class="formSep col-md-12">
<g:formRemote update="searchResult" class="form-inline" role="form" name="form"
url="[controller: 'autoRateRecord', action: 'search']" onSuccess="initPagination(data)">
<div class="form-group col-lg-2">
<g:select class="form-control" name="notified" from="${['done', 'undone']}"
noSelection="${['null': 'Oops']}">
</g:select>
</div>
<div class="form-group col-lg-2 pull-right">
<button type="submit" class="btn btn-primary btn-lg">
<span class="glyphicon glyphicon-search"></span> search
</button>
</div>
</g:formRemote>
</div>
<div id="searchResult">
<g:render template="searchList"/>
</div>
<script type='text/javascript'>
function initPagination(data) {
console.log("------> " + data)
$("#Pagination").pagination(10, {
callback: getRecordList(1),
prev_text: "prev",
next_text: "next",
items_per_page: 15,
num_edge_entries: 1
});
}
**!!!!!!! need formRemote data !!!!!!!**
function getRecordList(page_index) {
<g:remoteFunction controller="autoRateRecord" action="search" update="searchResult" params="'page='+page_index"/>
}
// On load, style typical form elements
$(function () {
});
</script>
我会将分页脚本更改为
$("#pageHiddenFieldId").val(pageNo);
$("#myForm").submit();
$("#pageHiddenFieldId").val(pageNo);
$("#myForm").submit();