jquery-easyui combobox combogrid 级联不可编辑实例
jquery-easyui combobox combogrid 级联不可编辑实例
如何让jquery-easyui的combobox像select那样不可编辑?
为combobox添加editable属性 设置为false
$('#goods_series').combobox({
url:"xxx/getBrandsGoodsSeries"+"?goods_brand_id="+goodsbrand,
valueField:'goods_series',
textField:'goods_series',
editable:false
});
获取值:
'goods_series':$("#goods_series").combobox("getValue"),
表单:
<input class="easyui-combobox" type="text" id="goods_series" style="border:solid 1px #95b8e7;width:120px;height:23px;" />
通过combogrid 选择级联的方式加载内容:
function goodsbrandSelect(){
var goodsbrand = -1;
var brandgrid = $('#goodsbrand').combogrid('grid').datagrid('getSelected');
if (brandgrid != null) {
goodsbrand = brandgrid.goods_brand_id;
}
$('#goods_series').combobox({
url:"xxx/getBrandsGoodsSeries"+"?goods_brand_id="+goodsbrand,
valueField:'goods_series',
textField:'goods_series',
editable:false
});
}
后台thinkphp代码:
public function getBrandsGoodsSeries(){
$goods_brand_id = I('get.goods_brand_id', -1);
$result = array();
$goods = M('goods')->field('goods_id, goods_series')
->where(array('goods_brand_id'=>$goods_brand_id))->where("goods_series is not null")
->group("goods_series")->select();
if (!empty($goods)){
$result = $goods;
}
echo json_encode($result);
}
golang技术交流群:316397059,vuejs技术交流群:458915921 囤币一族:621258209,有兴趣的可以加入
微信公众号: 心禅道(xinchandao)投资论道