1.页面内容
<select id="inputMenu" class="easyui-combogrid" style=" width: 200px;"></select>
<a type="button" class="easyui-linkbutton" id="openTab" href="#">打开菜单</a>
2.js部分
$("#inputMenu").combogrid({
prompt:'输入关键字后自动搜索',
required:true,
mode:'remote',
url:getRequestPath('/resource/getCodeByInput'),
idField: 'name',
textField: 'code',
editable:true,
hasDownArrow:true,
onBeforeLoad: function(param){
var value = $("#inputMenu").combogrid('getValue');
if(value!=null && value!=undefined && value!=''){
param.tecode = value;
return true;
}else{
$("#inputMenu").combogrid('hidePanel');
return false;
}
},
onSelect:function(data){
$("#inputMenu").combogrid('setValue',data.code);
},
columns: [[
{field:'code',title:'Code',width:80,sortable:true},
{field:'name',title:'Name',width:120,sortable:true}
]]
});
java后台代码没有放上去,这是加载的远程数据,后台返回的值存在map中,以json数据格式显示