如何讓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