sopt值忽略区分大小写

时间:2012-06-26 11:18:58

标签: jqgrid struts2

在我的struts2jquery网格中,我已经给出了

<sj:gridColumn name="processName" index="processName" title="Process Name" search="true" searchoptions="{sopt: ['bw','cn']}"/>

对于sopt,我们的值如

{sopt:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']}

现在我想通过忽略字母大小写来获取网格中的数据。但是如果我们以与存储相同的方式进行搜索,它就会过滤数据。即; (比如)如果我存储以'D'开头的数据,它将不会过滤以'd'开头的数据。我该怎么解决这个问题。这样做有什么选择吗?

2 个答案:

答案 0 :(得分:0)

此链接可以帮助您struts2 jquery plugin wiki grid

您应该定义自己的搜索操作类来进行搜索。顺便说一句,它应该是 <sjg:gridColumn/> o_O

答案 1 :(得分:0)

我找到了JavaScript的解决方案:

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


<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>