Search 如果在jqgrid中的自定义格式化程序中完成日期格式化,则发现无法工作

Search 如果在jqgrid中的自定义格式化程序中完成日期格式化,则发现无法工作,search,jqgrid,formatter,Search,Jqgrid,Formatter,我通过扩展自定义格式化程序中的jqgrid格式来进行日期格式化。如果我喜欢,那么“查找”功能不起作用。下面是示例colModel和自定义格式化程序函数 colModel = {name:currentLevelInDate, label:"Period Beginning (GMT)", index:currentLevelInDate,sorttype: "date",datefmt: datefmt, formatter:"formatDate", unformat: 'unformatDa

我通过扩展自定义格式化程序中的jqgrid格式来进行日期格式化。如果我喜欢,那么“查找”功能不起作用。下面是示例colModel和自定义格式化程序函数

colModel = {name:currentLevelInDate, label:"Period Beginning (GMT)", index:currentLevelInDate,sorttype: "date",datefmt: datefmt, formatter:"formatDate",
unformat: 'unformatDate', formatoptions: { newformat:newFormat, srcformat:srcFormat}}

formatDate : function(cellvalue, opts, rowObject) {
...
...
var op = $.extend({}, $.jgrid.formatter.date);
if(opts.colModel.formatoptions != undefined) {
    op = $.extend({}, op, opts.colModel.formatoptions);
}

cellDisplayValue = $.fmatter.util.DateFormat(op.srcformat,cellvalue,op.newformat,op);
....

return cellDisplayValue;
}

你应该发布更多你使用的完整代码。例如,您使用变量
datefmt
newFormat
srcFormat
,但不包括变量的定义

代码中的一个明显错误是将函数名用作字符串:

格式化程序:“格式化日期”
而不是作为变量使用:
formatter:formattate
。只有将
formatDate
定义为
$.fn.fmatter
对象的属性时,语法
格式化程序:“formatDate”
才是正确的。如果您这样做,那么您应该包括完整的代码,它准确地显示了您所做的事情。如果只在怀疑存在错误的地方发布代码片段,则无法在代码中找到错误。最好是发布完整的代码,可以用来重现您的问题