所以我正在尝试在 grails 中使用自动完成的不同途径,这就是我到目前为止所得到的......
“对象” Controller (是的,事后看来,我知道那是一个非常糟糕的名字):-
def objectFinderAJAX = {
def objectsFound = Object.withCriteria{
ilike 'objDesc', '%' + params.term + '%'
}
render (objectsFound as JSON)
}
在页面的头部我有这个: -
$(document).ready(function(){
$("#eventList > tbody > tr").find('input[type=text]').each(function() {
$(this).autocomplete({
source: '<g:createLink controller='Object' action='objectFinderAJAX'/>'
});
});
});
在正文中,我有一个表格,其简化形式看起来像这样(这是在加载时使用多个 AJAX 调用构建的):-
<table id="eventList">
<col width="500">
<col width="750">
<tr id = 0 class="even" name="main">
<td colspan="3">
<table id = "sub">
<tr>
<td><b>Action</b></td>
<td><select style="width:375px;" name="events[0].id" required="required" id="events[0].id" ><option value="11" >Check a links displayed text</option></select></td>
<td>
<b>Object</b>
</td>
<td>
<input style="width:500px" id="autoLook[0].id" name="autoLook[0].id" value= "Browser"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
当我在输入中输入任何东西时,机器人什么也没有发生,有什么线索吗?我什至尝试在 Controller 中添加一个 println 只是为了输出任何东西,它没有注册......我看不到 Firebug 中发生的任何事情。
最佳答案
当我解决了关于更改 ID 和名称的问题后,我最终重新使用了 Richui,它几乎可以满足我开箱即用的所有需求。
原始问题是 here .
关于javascript - Grails jQuery-ui 自动完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20078013/