此文为网络摘取……来自csdn cjz_huateng的专栏
<script>
$(function(){
$("#cc").combogrid({
panelWidth:400,
value:'safds',//缺省值
idField:"code",
textField:"name",
url:"datagrid_data.json",
columns:[[
{field:'code',title:'Code',width:60},
{field:'name',title:'Name',width:100},
{field:'addr',title:'Address',width:120},
{field:'col4',title:'Col41',width:100}
]]
});
});
//重新加载数据源
function reload(){
$('#cc').combogrid('grid').datagrid('reload');
}
//设置select中的值
function setValue(){
$("#cc").combogrid("setValue","003");
}
//获取下拉列表中选择的值
function getValue(){
var val = $('#cc').combogrid('getValue');
alert(val);
}
//禁用组件
function disable(){
$('#cc').combogrid('disable');
}
//启用组件
function enable(){
$('#cc').combogrid('enable');
}
//获取选中的表格的数据
function getGridValue(){
var grid=$("#cc").combogrid("grid");//获取表格对象
var row = grid.datagrid('getSelected');//获取行数据
alert("选择的grid中的数据如下:code:"+row.code+" name:"+row.name+" addr:"+row.addr+" col4:"+row.col4);
}
function clear(){
$("#cc").combogrid("clear");
}
</script>