简体   繁体   English

使用DependsOn进行Grails自动完成不起作用

[英]Grails Autocomplete With DependsOn doesn't work

I have this code in my .gsp: 我的.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 我使用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" println参数不会返回id =“ selecion1”的输入值

why??? 为什么???

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) 1)尽管插件的页面上的例子我不知道的是,Grails的UI自动完成dependsOn可以是任何东西,但另一个自动完成控制,因为它需要订阅控制了“依赖”的“itemselect”事件(看插件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: 2)如果将“依赖于”控件更改为另一个自动完成功能(它们可以像正常的HTML selects一样工作),请尝试对dependsOn属性使用以下语法:

dependsOn="[label:'(control name)',value:'(desired param name)',useId:(true to use select id value)]"

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/ 还可以查看grails ui演示,该演示中包含每个组件的有效示例代码: http : //code.google.com/p/guidemo/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM