我只想在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 –