开发者

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;
}


What you have there is what I have had to do for sorting, there is no built in way for the multiselect to do sorting, unless they added it with 1.7 having just been released.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜