2013-04-15 35 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']} } 

我覺得很反直覺來設置某種類型的搜索才能正常工作。改爲使用數據類型可能會更好。

相關問題