Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You don't post the full JavaScript code, so I write some remarks how you jqGrid can be optimized based on existing information.</p> <ol> <li>You should better avoid the usage of <code>afterInsertRow</code> and do the same work in <code>gridComplete</code> or <code>loadComplete</code>. Then you can add <code>gridview: true</code> parameter in the definition of jqGrid and the grid will be constructed quickly (read <a href="https://stackoverflow.com/questions/3025305/jqgrid-firefox-and-css-text-decoration-problem/3026421#3026421">jqgrid, firefox and css- text-decoration problem</a> for more details). Your current action in <code>afterInsertRow</code> can be easy replaced by <code>jQuery('.jqgrow',jQuery('#tblVariables')).addClass('jstree-draggable');</code> in <code>loadComplete</code> or <code>gridComplete</code>.</li> <li>You construct the value of <code>Groups</code> column based on the contain of hidden <code>HiddenGroups</code> column. The data which you send from the server as the contain of <code>Groups</code> column seems be overwritten. You can construct the same contain of <code>Groups</code> column with respect of <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter" rel="nofollow noreferrer">custom formatter</a> of the <code>Groups</code>. Then probably you can remove unneeded <code>HiddenGroups</code> column at all. Look at <a href="https://stackoverflow.com/questions/2991267/jqgrid-editable-column-that-always-shows-a-select/2992064#2992064">jqGrid: Editable column that always shows a select</a> for an example of custom formatter and at <a href="https://stackoverflow.com/questions/3054811/add-multiple-input-elements-in-a-custom-edit-type-field/3055626#3055626">Add multiple input elements in a custom edit type field</a> as example of <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#custom" rel="nofollow noreferrer">custom editing</a>. Probably defining of <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter#unformatting" rel="nofollow noreferrer">custom unformater</a> will be also interesting for you.</li> <li>It's a little the matter of taste, but the usage of <code>formatter:'checkbox'</code> for the column <code>HiddenVar</code> seems me appropriate. Moreover one can see that you send "True" or "False" strings from the server as the value for the column. Sending of 1 and 0 follows to the same results, but reduce the size of the data which are sent.</li> <li>You can reduce the size of your javascript if you remove some default values (like <code>jsonReader</code>) or deprecated values like <code>imgpath</code> (see <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:upgrade_from_3.4.x_to_3.5" rel="nofollow noreferrer">http://www.trirand.com/jqgridwiki/doku.php?id=wiki:upgrade_from_3.4.x_to_3.5</a>) and remove default values from <code>colModel</code> (like <code>editable: false</code>).</li> </ol> <p>Description of some other general optimization ways for jqGrid you can find in <a href="https://stackoverflow.com/questions/2999955/what-is-the-best-way-to-optimize-my-json-on-an-asp-net-mvc-site/3001933#3001933">what is the best way to optimize my json on an asp.net-mvc site</a>.</p> <p><strong>UPDATED</strong>: Probably you don't really need to insert select elements in <code>Groups</code>. Instead of that you can do this only if the row is selected or is in editing mode. Removing of construction of the select elements from the whole <code>Groups</code> can improve performance of your grid and simplify the code. You can use <code>editoptions</code> with <code>value</code> as a function or use other possibilities of <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#editoptions" rel="nofollow noreferrer">editoptions</a>. Binding of <code>onchange</code> event to the select can be then replaced to <code>dataEvents</code> with <code>type: 'change'</code>.</p>
 

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