Struts2 jqGrid Remove x On Individual Column Filters

1.2k views Asked by At

I have a struts2-jquery jqGrid page that has a grid with column filters. Some of the columns are date formats, which I do not want to be visible, so I removed the input fields for that column filter using .hide().

$("#gs_fraudEndDt").hide();

However, I still have the small "x" next to the field that I just hid. Below is the html for that shows the column field.

<th class="ui-state-default ui-th-column ui-th-ltr" role="columnheader">
  <div style="position:relative;height:100%;padding-right:0.3em;padding-left:0.3em;">
     <table class="ui-search-table" cellspacing="0">
     <tbody>
       <tr>
          <td class="ui-search-oper" colindex="8" style="display: none;"></td>
          <td class="ui-search-input">
             <input id="gs_fraudEndDt" type="text" value="" name="fraudEndDt" style="width: 100%; padding: 0px; display: none;" disabled="">
          </td>
          <td class="ui-search-clear">
             <a class="clearsearchclass" style="padding-right: 0.3em;padding-left: 0.3em;" title="Clear Search Value">x</a>
          </td>
        </tr>
     </tbody>
  </table>

There are multiple td tags where class="clearsearchclass" so I need to include selecting the colindex=8 (from the td tag a few lines up) to specify this specific column.

What is the selector that I need to use to get this specific td tag? Or is there a better way to hide individual filters and the "x"?

Thanks for any help

1

There are 1 answers

1
Oleg On BEST ANSWER

One can specify searchoptions: {clearSearch: false} in colModel for the specific column. It removes the x button from the filter bar for the corresponding column. I suppose that you should specify the option like any other search option inside of <sjg:gridColumn> (see the documentation).