Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to customize the search using jqgrid + Struts2 jquery pluggin + Freemarker template
    primarykey
    data
    text
    <p>I'm running a webapp using Hibernate + Struts2 + Struts2-jquery (jqgrid) + freemarker. I'm trying to create a jqgrid (JSON) to present some results to the user and enable some complex filtering of the data using multisearch. I have the standard functionality working just fine. This is my ftl:</p> <pre><code>&lt;div id="mygridfilter"&gt; &lt;@sj.submit id="grid_edit_searchbutton" value="Search" onClickTopics="searchgrid" button="true"/&gt; &lt;@sj.submit id="grid_edit_colsbutton" value="Show/Hide Columns" onClickTopics="showcolumns" button="true"/&gt; &lt;@sj.submit id="grid_reload_button" onClickTopics="reloadItems" value="Reload" button="true"/&gt; &lt;/div&gt; &lt;hr /&gt; &lt;@sjg.grid id="gridedittable" caption="Glycobase Users" dataType="json" href="json_table.action" pager="true" navigator="true" navigatorSearchOptions="{multipleSearch:true, sopt:['cn'], reloadAfterSubmit:true, }" gridModel="gridModel" reloadTopics="reloadItems" rowList="10,15,20" rowNum="15" rownumbers="true" sortname="userName" sortorder="asc" navigatorAdd="false" navigatorEdit="false" navigatorDelete="false" navigatorView="true" width="800" prmNames="" resizable="true" altRows="true" navigatorExtraButtons="{ seperator: { title : 'seperator' }, hide : { title : 'Show/Hide', icon: 'ui-icon-wrench', topic: 'showcolumns' }, alert : { title : 'Alert', onclick: function(){ alert('Grid Button clicked!') } } }" shrinkToFit="true" &gt; &lt;@sjg.gridColumn name="userName" index="contributorName" title="Contributor Name" sortable="true"/&gt; &lt;@sjg.gridColumn name="email" index="email" title="Email" sortable="true"/&gt; &lt;@sjg.gridColumn name="fullName" index="fullName" title="Full Name" sortable="true"/&gt; &lt;/@sjg.grid&gt; &lt;script&gt; </code></pre> <p>and some javascript on top:</p> <pre><code>&lt;script&gt; $.subscribe('showcolumns', function(event,data) { $.struts2_jquery.require("js/plugins/grid.setcolumns.js"); $("#gridedittable").jqGrid('setColumns',{}); }); $.subscribe('searchgrid', function(event,data) { $("#gridedittable").jqGrid('searchGrid', { multipleSearch:true, sopt:['cn'], reloadAfterSubmit:true } ); }); &lt;/script&gt; </code></pre> <p>This is the current behaviour: When I click on the search icon (or the search button) a dialogue window allows to multisearch the columns fields with some operator (i.e. "name" "contains" "..."). What I need is to include in the search some extra query to further refine my query on the server side... i.e. say I need an extra searching criteria "name length" "greater" "...". 1) I can I add a criteria to the search dropdown list without having the relative column? 2) How can I append to JSON.filters sent to the server the query? i.e.</p> <pre><code>filters: "{"groupOp":"AND","rules":[{"field":"nameLength","op":"gt","data":"4"}]}" </code></pre> <p>On the server side I would then have setter and getter for nameLenght, and perform the hibernate criteria query accordingly to return the correct rows to the gridModel. </p> <p>Any help?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload