Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Could you explain <strong>why</strong> you need load the script with the jqGrid with respect of <code>load</code>? It seems to me that there are a better way to use jqGrid.</p> <p>One problem in you code is in general organization of the work with the grid. You should create jqGrid <strong>one time</strong> per page and you should call <code>navGrid</code> also only <strong>once</strong>. The reason is very clear. The jqGrid will create from simple <code>&lt;table id="report"&gt;&lt;/table&gt;&lt;div id="report-box"&gt;&lt;/div&gt;</code> HTML code fragment a table with the title, columns, pager and so on. Such kind of transformation should be done <strong>once</strong>. If you don't want to show the grid contain you can place it inside of the hidden div (having style="display:none"). If you don't want to load the grid contain at the initializing time you should sat <code>datatype:'local'</code> at the beginning and no request to the server will be done. In the <code>$('#form').submit</code> handle you can get the data from the form (like you already do with <code>$(this).serialize()</code>), set with respect of <code>setGridParam</code> the <code>datatype:'json'</code> and <code>url</code> (better would be use <code>postData</code> instead of modifying of the <code>url</code>) and call <code>jQuery("#report").trigger("reloadGrid")</code>. This will follow to sending the request to the server. The <code>url</code> will appended with the data from the <code>postData</code> (see <a href="https://stackoverflow.com/questions/2928371/how-to-filter-the-jqgrid-data-not-using-the-built-in-search-filter-box/2928819#2928819">here</a> for more informataion) and all will good work.</p> <p><strong>UPDATED</strong>: I agreed with your description of the new design of the page describe in the updated last part of your question. I can add only some possible optimizations.</p> <p>1) It seems to me that you can use button of <code>type='button'</code> instead of <code>type='submit'</code> and no probably no form is really needed. If you want you can use <code>fieldset</code> instead. Because the form exist now I'll use it below. You can set <code>click</code> handler with the <code>jQuery("#report").trigger("reloadGrid")</code>: <code>$("#form button.btn").click(function(){/*here call reloadGrid*/})</code>.</p> <p>2) You can use in jqGrid parameter <code>postData</code> about the following</p> <pre><code>postData: { date: function() { return $("#form input").val(); }, tpl: function() { return $("#form select option:selected").val(); } } </code></pre> <p>then at every grid loading will be get automatically <strong>the current</strong> values from the form</p> <p>2) I don't know how different are the columns of different grids which you need. So you can for example follow the way of dynamical creating/enabling of columns which I described in <a href="http://www.ok-soft-gmbh.com/jqGrid/DynamicColumnNumbers.htm" rel="nofollow noreferrer">this</a> and <a href="http://www.ok-soft-gmbh.com/jqGrid/Martix.htm" rel="nofollow noreferrer">another</a> answers (see demos). Another more simple way is to use <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods#add_on_grid_methods" rel="nofollow noreferrer">GridUnload</a> method every time if you change the type of the report in the select box. It will destroy the grid and you can recreate it with the new column parameters. See <a href="http://www.ok-soft-gmbh.com/jqGrid/RecreateGrid.htm" rel="nofollow noreferrer">the demo</a> from the <a href="https://stackoverflow.com/questions/4232038/jqgrid-add-new-column/4232168#4232168">another answer</a>.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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