我认为你想要的应该很容易实现。我为您制作了一个快速复制粘贴/窃取在一起的演示页面。
如果您单击日期列,您将获得一个日历选择器。
如果您单击“客户”列并删除内容,您将看到一个自动完成程序(css 不适合快速粘贴),其中列出了美国城市(我知道城市不是客户名称,只是一个演示)。
代码取自jqGrid单元格编辑演示页面+jQuery Autocomplete演示页面
http://jsbin.com/owatu(将/edit附加到网址以查看代码)
当然,这个演示有点粗糙
- CSS 问题
- 如果用户在鼠标中使用箭头键+回车键,则在插入 afterSaveCell 以获取 jQgrid 以插入从自动完成器中选择的值时快速破解它无需破解即可工作
我猜想在将 autocomplete 和 jqGrid 完全集成时可以删除 afterSaveCell hack。
基本上可以归结为
jQuery("#celltbl").jqGrid({
...
{name:'name', width:100, editable:true}, //e.g.
...
afterEditCell: function (id,name,val,iRow,iCol) {
if(name=='name') {
//cities here is local json object
jQuery("#"+iRow+"_name","#celltbl").autocomplete(cities);
}
},
afterSaveCell : function(rowid,name,val,iRow,iCol) {
if(name == 'name') {
jQuery("#celltbl").jqGrid('setRowData',rowid,{name:jQuery(".ac_over").text()});
jQuery(".ac_results").remove();
}
}
...