我只想在SELECT更改时渲染部分模板。我试过onchange和remotFunction,但它不会编译。Grails在选择中对更改进行部分模板渲染
在我写的GSP:
<g:select name="sawMill" from="${prodBuffer}" value="" onchange="${remoteFunction(action: 'availableProducts')}"/>
,并在控制器:
def availableProducts() {
render(template:"AvailableProductData", model:[prodBuffer: getBufferList()])
}
错误:
Class
groovy.lang.MissingMethodException
Message
Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/orders_and_Store/list.gsp:154] Error executing tag <g:form>: Error evaluating expression [remoteFunction(action: 'availableProducts')] on line [24]: No signature of method: D__Grails_projects_torntrading_grails_app_views_orders_and_Store_list_gsp.remoteFunction() is applicable for argument types: (java.util.LinkedHashMap) values: [[action:availableProducts]]
Caused by
No signature of method: D__Grails_projects_torntrading_grails_app_views_orders_and_Store_list_gsp.remoteFunction() is applicable for argument types: (java.util.LinkedHashMap) values: [[action:availableProducts]]
我已经看到了很多不同的解决方案但它们更复杂,我只想在选择更改时呈现一块gsp,并且我不认为我需要任何参数。
如果你使用Grails 3,你必须添加这个依赖项(不推荐)到你的应用程序https://plugins.grails.org/plugin/grails/ajax-tags –