简体   繁体   中英

Sort multiselect in dojo/dijit

My question is - is there any way in dojo/dijit multiselect to sort the options or i have to do it manual?

Thanks

Edit:

So far i solved my problem using a sort algorithm. In case someone need it

function sortSelect(selElem) {
        var tmpAry = new Array();
        for (var i=0;i<selElem.options.length;i++) {
                tmpAry[i] = new Array();
                tmpAry[i][0] = selElem.options[i].text;
                tmpAry[i][1] = selElem.options[i].value;
        }
        tmpAry.sort();
        while (selElem.options.length > 0) {
            selElem.options[0] = null;
        }
        for (var i=0;i<tmpAry.length;i++) {
                var op = new Option(tmpAry[i][0], tmpAry[i][1]);
                selElem.options[i] = op;
        }
        return;
}

您所拥有的是我必须要做的排序,没有多重选择进行内置选择的内置方法,除非他们在刚发布的1.7中添加了它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM