如何让easyui combox默认选中多项


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

Name Parameter Description
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作为显示,报表的列名就可以自由的控制。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM