jspstruts2struts2-jquerystruts2-jquery-gridstruts2-jquery-plugin

Filter data in Struts2 jqGrid


I want to add a search feature to my struts2 jquery grid. I cound not find a way to add textboxes inline for filter purpose so I thought of configuring the search feature already there in struts2 jquery grid. i saw this article but while implementing i still couldnt fix it.

This is my grid code :

<sjg:grid      
    id="list_gov_advocate" 
    caption="Advocate List"     
    href="%{remoteurl}"
    pager="true"       
    gridModel="list_gov_advocate" 
    rowList="10,15,20,30,50" 
    rowNum="15" 
    width="900" 
    loadonce="true"
    rownumbers="true" 
    resizable="true" 
    viewrecords="true" 
    name="list_gov_advocate" 
    navigator="true"
    navigatorView="false"
    navigatorDelete="true" 
    navigatorSearch="true"
    navigatorSearchOptions="{multipleSearch:true}"
    >    

    <sjg:gridColumn name="adv_name" index="adv_name" title="Name of Advocate" editable="true" sortable="false" search="true"  searchoptions="{sopt:['eq','ne'] , dataUrl : '%{selecturl}'}"/>         
    <sjg:gridColumn name="adv_type" index="adv_type" title="Type" editable="true" sortable="false"/>               
    <sjg:gridColumn name="adv_Id" index="adv_Id" title="View Details"  editable="true" sortable="false" formatter="ViewAdvocate"/>


 </sjg:grid>

Can anyone help me what changes I need to do here to implement search feature in my grid? Thanks In Advance.


Solution

  • Finally I was able to implement search feature!! No need to add the javascript code as I have edited the question. Only make sure that the loadonce attribute is set to true. ie. loadonce="true" Rest of the code remains the same.