修復(fù)jQuery tablesorter無法正確排序的bug(加千分位數(shù)字后)

字號:


    這篇文章主要介紹了如何修復(fù)jQuery tablesorter無法正確排序的bug(加千分位數(shù)字后)的相關(guān)資料,需要的朋友可以參考下
    找到函數(shù):
    function getElementText(config, node) {
    var text = "";
    if (!node) return "";
    if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;
    if (config.textExtraction == "simple") {
    if (config.supportsTextContent) {
    text = node.textContent;
    } else {
    if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
    text = node.childNodes[0].innerHTML;
    } else {
    text = node.innerHTML;
    }
    }
    } else {
    if (typeof(config.textExtraction) == "function") {
    text = config.textExtraction(node);
    } else {
    text = $(node).text();
    }
    }
    return text;
    }
    把上邊的function改成下邊的即可:
    function getElementText(config, node) {
    var text = "";
    if (!node) return "";
    if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;
    if (config.textExtraction == "simple") {
    if (config.supportsTextContent) {
    text = node.textContent;
    } else {
    if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
    text = node.childNodes[0].innerHTML;
    } else {
    text = node.innerHTML;
    }
    }
    } else {
    if (typeof(config.textExtraction) == "function") {
    text = config.textExtraction(node);
    } else {
    text = $(node).text();
    }
    }
    return (text.replace(/,/g,''));
    }
    以上內(nèi)容是小編給大家介紹的修復(fù)jQuery tablesorter無法正確排序的bug,希望對大家有所幫助!