Grails 自动完成与 DependsOn 不起作用
我的 .gsp 中有这段代码:
<input id="selection1" type="hidden" name="selection1" value="test"/>
<gui:autoComplete
minQueryLength='2'
queryDelay="0.2"
id="corso"
controller="utente"
action="corsoAutoComplete"
resultName="corsi"
dependsOn="selection1"
/>
我使用 Grails-ui 1.2
我的控制器是:
def corsoAutoComplete={
println params;
def corso = Corso.findAllByNomeIlike("%${params.query}%",[max:15,cache:true])
corso = corso.collect{
[id:it.id, name:it.nome]
}
def jsonCorso = [corsi:corso]
render jsonCorso as JSON
}
println params 不返回 id="selecion1" 的输入值,
为什么???
I have this code in my .gsp:
<input id="selection1" type="hidden" name="selection1" value="test"/>
<gui:autoComplete
minQueryLength='2'
queryDelay="0.2"
id="corso"
controller="utente"
action="corsoAutoComplete"
resultName="corsi"
dependsOn="selection1"
/>
I use Grails-ui 1.2
My controller is that:
def corsoAutoComplete={
println params;
def corso = Corso.findAllByNomeIlike("%${params.query}%",[max:15,cache:true])
corso = corso.collect{
[id:it.id, name:it.nome]
}
def jsonCorso = [corsi:corso]
render jsonCorso as JSON
}
println params doesn't return the value of input with id="selecion1"
why???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1) 尽管插件页面上有示例,但我不确定 Grails UI 自动完成
dependsOn
可以是另一个自动完成控件,因为它需要订阅“itemselect” “依赖”控件中的事件(查看 InputTagLib.groovy 的插件源)2)如果将“依赖”控件更改为另一个自动完成功能(可以使它们像普通 HTML 一样工作) selects),请尝试对
dependsOn
属性使用以下语法:另请查看 grails ui 演示,其中包含每个组件的工作示例代码:
http://code.google.com/p/guidemo/
1) Despite the example on the plugin's page I'm not sure that the Grails UI autocomplete
dependsOn
can be anything but another autocomplete control because it needs to subscribe to an "itemselect" event in the "depended on" control (look at the plugin source for InputTagLib.groovy)2) If you change the "depended on" control to another autocomplete (they can be made to work like normal HTML selects), try using the following syntax for the
dependsOn
property:Also have a look at the grails ui demo that has working sample code for each of the components:
http://code.google.com/p/guidemo/