2013-04-15 34 views
1

我正在使用启用了工具栏搜索的jqGrid。我已将我的搜索选项配置为'eq'。但是,当我在搜索栏上输入十进制数时,不会显示有效记录。jqGrid工具栏在小数点上搜索

例如: 当我输入12时,记录与12.00显示,这是正确的。 当输入12.50时,12.50的记录不显示,这是不正确的。

我用sorttype作为编号进行了实验,编号为formatter,但有小数位,但我似乎无法使其工作。

电网定义:

$("#productListingGrid").jqGrid({ 
    datastr: products, 
    datatype: 'jsonstring', 
    jsonReader: { 
     root: 'products', 
     repeatitems: false, 
     cell: 'products.branches', 
     id: 'productNumber' 
    }, 
    loadonce: true, 
    // -1 no longer works: https://github.com/tonytomov/jqGrid/issues/317 
    rowNum: 10000, 
    height: 580, 
    width: 1250, 
    colNames: columnNames, 
    colModel: columnModel, 
    sortname: 'productNumber', 
    sortorder: "asc", 
    caption: 'PRODUCT LIST', 
    headertitles: true, 
    altRows: true, 
    altclass: 'gridStripe', 
    gridview: true, 
    footerrow: true, 
    ignoreCase: true, 
    shrinkToFit: false 
}); 

我列模型定义:

{ name: 'totalValue' , width:55, align:'right', formatter: 'currency', searchoptions:{sopt:['eq']} } 

代码以启用该工具栏的搜索:

grid.jqGrid('filterToolbar', {searchOnEnter: false}); 

我想知道这是否是一个电流限制?

非常感谢。

注: 我目前使用下列内容:

jQuery - 1.9.1 
jQuery UI - 1.10.2 
jqGrid - 4.4.5 
+0

你可以添加一些你使用的JavaScript代码吗? – Oleg

+0

@Oleg我添加了一些代码。你需要看什么具体的东西? – Paul

+0

@Oleg我已经通过设置sorttype工作了!我会发布答案。 – Paul

回答

2

我得到这个通过设置sorttype'float'工作。

{ name: 'totalValue' , width:55, align:'right', formatter: 'currency', searchoptions:{sopt:['eq']} } 

{ name: 'totalValue' , width:55, align:'right', sorttype:'float', formatter: 'currency', searchoptions:{sopt:['eq']} } 

我觉得很反直觉来设置某种类型的搜索才能正常工作。改为使用数据类型可能会更好。

相关问题