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