2012-10-04 54 views
0

第一次嘗試jqGrid。我需要顯示工具欄搜索過濾器。但它從不在工具欄中顯示搜索文本框。沒有出現在jqGrid中的搜索工具欄文本框

下面是我的代碼,

<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" /> 

<link rel="stylesheet" type="text/css" media="screen" href="css/smoothness/jquery-ui-1.8.24.custom.css" /> 


<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script> 

<script src="js/jquery.jqGrid.min.js" type="text/javascript"> </script> 

<script src="js/grid.locale-en.js" type="text/javascript"></script> 


<script type="text/javascript"> 


    jQuery().ready(function(){ 
    jQuery("#list2") 
      .jqGrid({ 
       url: 'server.php', 
       datatype: "json", 
    colNames: ['Product Id', 'Product Name', 'Supplier Id', 'Unit Price'], 
       colModel: [{ 
        name: 'productid', 
        index: 'productid', 
        search: true, 
        width: 55 
       }, { 
        name: 'productname', 
        index: 'productname', 
        width: 90 
       }, { 
        name: 'supplierid', 
        index: 'supplierid', 
        width: 100 
       }, { 
        name: 'unitprice', 
        index: 'unitprice', 
        width: 80, 
        align: "right" 
       } 
       ], 
       rowNum: 10, 
       rowList: [10, 20, 30], 
       pager: '#pager2', 
       sortname: 'productid', 
       viewrecords: true, 
       sortorder: "desc", 
       caption: "JSON Example" 
      }) 
    }); 

    jQuery("#list2") 
      .jqGrid('navGrid', '#pager2', { 
       edit: false, 
       add: false, 
       del: false 
      }); 

jQuery("#list2").jqGrid 
    ('filterToolbar',{stringResult: true,searchOnEnter : false}); 

</script> 

我現在用的是4.4.1版本。我在下載時檢查了自定義添加方法複選框。

我是否缺少任何js文件?

回答

0

非常愚蠢的錯誤。我將調用filterToolbar放在ready函數之外。它應該在ready函數中。

固定

對不起,這個問題,但我仍然不會刪除,因爲這樣的錯誤是常見的我想..所以它對於那些有用的那種... ;-)

相關問題