如何让easyui combox默认选中多项

开始时,我以为用'selected': true ,就可以了,最后给想要选中的项加上去后,发现还是只能选中第一项,最后查看官方文档

NameParameterDescription
options none Return the options object.
getData none Return the loaded data.
loadData data Load the locale list data.
reload url Request the remote list data. Pass the 'url' parameter to override the original URL value.

Code example:

$('#cc').combobox('reload');  // reload list data using old URL
$('#cc').combobox('reload','get_data.php');  // reload list data using new URL
setValues values Set the combobox value array.

Code example:

$('#cc').combobox('setValues', ['001','002']);
setValue value Set the combobox value.

Code example:

$('#cc').combobox('setValue', '001');
clear none Clear the combobox value.
select value Select the specified item.
unselect value Unselect the specified item.

setValues,就可以解决这个问题。稍微注意下,这个属性要写到加载数据的后面,要不然它哪找的到啊。这个属性还有个好处,就是在添加的VALUES自由的设置前后顺序,这样,结合报表的话,id可以作为字段传过去,text作为显示,报表的列名就可以自由的控制。

posted @ 2013-01-21 10:47  Archosaur  Views(10234)  Comments(0Edit  收藏  举报