发新帖

[web前端] 修复jQuery tablesorter无法正确排序的bug(加千分位数字后)

零下一度 2023-10-27 477

找到函数:

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,''));
}

以上内容是小编给大家介绍的修复jQuery tablesorter无法正确排序的bug,希望对大家有所帮助!


@积木网




最新回复 (0)
返回
零下一度
主题数
931
帖子数
0
注册排名
1