所以我正在尝试另一种方法来在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>

当我在输入中输入ththign时,没有任何反应,有什么线索吗?我什至尝试将println添加到 Controller 中只是为了输出任何内容,而没有注册该内容……我看不到firebug中发生的任何事情。

最佳答案

我最终回到了使用richui的方法,解决了有关更改ID和名称的问题后,几乎完成了我需要的所有操作。

原始问题是here

08-08 07:29
查看更多