jquery easyui combotree獲取值, combotree獲取多個值


 

================================

©Copyright 蕃薯耀 2020-01-06

https://www.cnblogs.com/fanshuyao/

 

jquery easyui combotree獲取多個值是使用getValues方法的,不能使用getValue,只會返回第一個選中的值。

combotree使用getValues返回的是一個數組,包括所有選中的值,但一般只要字符串形式,兼容性好,避免后台接收不了。

 

/**
 * 獲取combotree的值,以字符串形式返回(英文逗號分隔)
 * @param combotreeId combotree id值
 * @returns {String}
 */
function getCombotreeValues(combotreeId){
    var result = "";
    var cmm_code_ids= $("#"+combotreeId).combotree('getValues');
    if(cmm_code_ids.length > 0){
        for(var i=0; i<cmm_code_ids.length; i++){
            result += cmm_code_ids[i] + ",";
        }
        if(result.indexOf(",") > -1){
            result = result.substring(0, result.length - 1)
        }
    }
    return result;
};

 

(如果你覺得文章對你有幫助,歡迎捐贈,^_^,謝謝!) 

 

 

================================

©Copyright 蕃薯耀 2020-01-06

https://www.cnblogs.com/fanshuyao/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM