javascript - Grails jQuery-ui 自动完成

标签 javascript jquery grails autocomplete

所以我正在尝试在 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/

相关文章:

grails - NumberFormatException对于尝试在grails中进行日期搜索时的输入字符串

grails - 在 Grails 1.3.7 中使用 Geb、Selenium 和 Spock 进行功能测试时出错

c# - 单击时如何使内容切换向下/向上滑动

javascript - 如何根据 Angular 确定绝对顶部和左侧位置? Javascript

javascript - 当您访问其中包含特定 ID 的 URL 时添加 CSS

javascript - jQuery += 变量帮助

javascript - 调整平滑滚动代码

javascript - JQuery 单击表格按钮

grails - Grails日志记录在 fork 模式下不起作用

javascript - 如何在 div 的中心放置弹出消息?