【发布时间】:2016-02-08 17:58:08
【问题描述】:
我们有一个填充为四个字符的数据字段..
例如,您可以使用“ABC”或“DEFG”。此数据用作过滤器工具栏中选择下拉列表的值。
在构建过滤器时,填充会被修剪;所以“ABC”现在是“ABC”..所以中间层的过滤失败了..“ABC”!=“ABC”
我修改了 jqgrid 源以删除修剪,这样安全吗?它解决了我的问题,但我不清楚我是否会制造更多问题。
/* the format of element of the searching toolbar if ANOTHER
* as the format of cells in the grid. So one can't use
* value = $.unformat.call($t, $elem, { colModel: cm }, iCol)
* to get the value. Even the access to the value should be
* $elem.val() instead of $elem.text() used in the common case of
* formatter. So we have to make manual conversion of searching filed
* used for integer/number/currency. The code will be duplicate */
if (cm.stype === "custom" && $.isFunction(searchoptions.custom_value) && $elem.length > 0 && $elem[0].nodeName.toUpperCase() === "SPAN") {
v = searchoptions.custom_value.call($t, $elem.children(".customelement").first(), "get");
} else {
//v = $.trim($elem.val()); // *** commented this out ***
v = $elem.val();
switch (cm.formatter) {
case "integer":
v = cutThousandsSeparator(v)
.replace(getFormaterOption("decimalSeparator", "number"), ".");
if (v !== "") {
// normalize the strings like "010.01" to "10"
v = String(parseInt(v, 10));
}
break;
case "number":
v = cutThousandsSeparator(v)
.replace(getFormaterOption("decimalSeparator"), ".");
if (v !== "") {
// normalize the strings like "010.00" to "10"
// and "010.12" to "10.12"
v = String(parseFloat(v));
}
break;
【问题讨论】:
标签: jquery jqgrid free-jqgrid