easyui combotree下拉框多选赋值

时间:2021-02-26 03:55:20

发现jquery.easyui.min.js

1.3.4版本的用setValues给多选下拉框赋值不成功,只能用1.3.1版本的

Html代码:

<input id="ProductLineId" name="ProductLineId" class="easyui-combotree"   value="@(Model.ProductLineId == null ? Guid.Empty.ToString() : Model.ProductLineId)" style="width:295px;_width:298px;"/>

  

JS加载数据

$("#ProductLineId").combotree({
onSelect: function (record) { },
onChange: function (a,b) { },
url: '@Url.Action("LoadProductSelect", "Base")' + "?checkedStr=@Model.ProductLineId",
valueField: 'id',
textField: 'text',
cascadeCheck: false,
multiple: true,
panelHeight: 100
//checkbox: true
});

  

JS赋值:

$("#ProductLineId").combotree("setValues", ["20140307-1748-2084-b7c9-1d6c3343b001", "20140307-1748-2084-b7c9-1d6c3343b004"]);
var arr = "@Model.ProductLineId".split(',');
var valueArr = new Array();
for (var i = 0; i < arr.length; i++) {
valueArr.push(arr[i]);
}
$("#ProductLineId").combotree("setValues", valueArr);