$(function(){ $('#search_hospitalName').combogrid({ mode : 'remote',//远程连接方式 //fitColumns:true,//自动大小 striped: true, method:'post',//请求方式 dataType:'json', panelWidth: 300, url: '<%=basePath%>HospitalInfoAction/simpleQuery', idField: 'hospitalName', textField: 'hospitalName', editable: true, pagination: true, //是否分页 columns: [[ {field: 'id',title: 'id',hidden: 'true',align: 'center'}, {field: 'hospitalName',title: '医院名称', 150,align: 'center'}, {field: 'areaCode',title: '医院地区', 149,align: 'center'} ]], keyHandler:{ up: function() {}, down: function() {}, enter: function() {}, query: function(q) { //动态搜索 $('#search_hospitalName').combogrid("grid").datagrid("reload", {'hospitalName': q}); $('#search_hospitalName').combogrid("setValue", q); } } }); });
页面:
<td>名称:</td> <td> <input id="search_hospitalName" name="hospitalName"class="easyui-combogrid" onkeydown="if(event.keyCode==13)query()" style=" 180px"> </td>