2012-06-25 27 views
2

我使用了一個struts2jquery網格,其中我給出了filter =「true」。所以它在客戶端過濾數據。但它僅在區分大小寫的情況下進行過濾。我需要無案例地獲取數據。所以我需要補充什麼。期待一些建議。謝謝 !!!在不區分大小寫的情況下在<sjg:grid>中過濾

回答

0

我發現用JavaScript的解決方案:

<%@ taglib prefix="s" uri="/struts-tags"%> 
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%> 
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%> 

    <s:url var="remoteurl" action="jsontable" /> 

    <sjg:grid id="gridtableID" 

     caption="Primjer JSON TABELE" 
     dataType="json" 
     href="%{remoteurl}" 
     gridModel="gridModel" 
     viewrecords="true" 
     pager="true" 
     pagerPosition="centar" 
     navigator="true" 
     navigatorSearch="true" 
     filter="true" 
     filterOptions="{stringResult:true}" 
     loadonce="true" 

     > 

     <sjg:gridColumn name="id" 
      index="id" title="ID" 
      formatter="integer" 
      search="false" 
      searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}" 
      editable="false" /> 
     <sjg:gridColumn name="name" index="name" title="Name" sortable="true" 
      search="true" 
      searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}" /> 
     <sjg:gridColumn name="country" index="country" title="Country" 
      search="true" 
      searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}"/> 
     <sjg:gridColumn name="city" index="city" title="City" search="true" 
      searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}" /> 
     <sjg:gridColumn name="creditLimit" index="creditLimit" 
      title="Credit Limit" formatter="currency" search="true" 
      searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}"/> 

    </sjg:grid> 

    <script> 
    $(document).ready(function(){ 
     $("#gridtableID").jqGrid('setGridParam', { ignoreCase: true}); 
     }); 
    </script> 
0

這可能是有點晚了,但這裏是一個簡單的解決方案:

第1步: 添加onCompleteTopics到SGJ:電網標籤。

<sjg:grid 
... 
onCompleteTopics="loadComplete" 
... 
> 

第2步: 添加.subscribe與下面的代碼中你的.jsp。

<script> 
    $.subscribe('loadComplete', function (event, data){ 
     $("#gridtable").jqGrid('setGridParam', { ignoreCase: true}); 
    }); 
</script> 

這應該關閉網格頂部的過濾器行的區分大小寫。這嚴格用於客戶端過濾。

相關問題