Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I agree with Craig Stuntz: usage of HTTP Compression of Dynamic Content can be very effective. But very useful can be also reducing of data which are sent.</p> <p>First of all you should no time send HTML data back to jqGrid. jqGrid has <strong>custom formatter</strong> (see <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter" rel="nofollow noreferrer">http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter</a> and a small example from <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>) which can be used to fill <code>&lt;TD&gt;</code> elements of jqGrid cells. Moreover html data inside of jqGrid data are very bad if you want to modify grid data. In this case the html data should be modified and send back to the server. So the best way is sending pure data from the server to jqGrid and use custom formatter to format data as a html fragment.</p> <p>In general you can use custom formatter to "decode" or "decompress" the data. For example, if you have in a column only data like "Bla Bla Bla" and "Ha Ha Ha", you can send 0 instead of "Bla Bla Bla" and 1 instead of "Ha Ha Ha". Inside of the custom formatter for the column you convert 0 and 1 back to the "Bla Bla Bla" and "Ha Ha Ha" strings. If you have general repeated data this approach will not work, but you can use the next (<code>jsonReader</code>) way instead.</p> <p>There are one more way of data compression: usage of <code>jsonReader</code> as a function (see <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#jsonreader_as_function" rel="nofollow noreferrer">http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#jsonreader_as_function</a> and <a href="https://stackoverflow.com/questions/2835957/jquery-with-asp-net-mvc-calling-ajax-enabled-web-service/2836817#2836817">jquery with ASP.NET MVC - calling ajax enabled web service</a>) and usage of <code>jsonmap</code> (see <a href="https://stackoverflow.com/questions/2690657/mapping-json-data-in-jqgrid/2706620#2706620">Mapping JSON data in JQGrid</a> for example), which can be also used as a function. This technique is a little more complex, but if you add in your question an example of JSON data which you send currently and the example of jqGrid definition (especially <code>colModel</code>) I will write an example how you can use <code>jsonReader</code> and <code>jsonmap</code> to compress your data.</p> <p><strong>UPDATED</strong>: One place of your code seems to me very suspected:</p> <pre><code>Name = "&lt;div class='showDescription' id= '" + i.id+ "'&gt;" + i.Name + "&lt;/div&gt;", </code></pre> <p>jqGrid add <code>id</code> attribute to the grid row (<code>&lt;tr&gt;</code> element), but you added manual the same id to the <code>&lt;div&gt;</code> element inside of cell (<code>&lt;td&gt;</code> element, which is child of the <code>&lt;tr&gt;</code> element). This can makes you much problems. A HTML not allowed to have a double ids.</p> <p>Corresponds your main question I can write a lot of general recommendations like:</p> <ul> <li>it is better to send boolean as <code>0</code> or <code>1</code> instead of <code>"true"</code> and <code>"false"</code> to reduce the data.</li> <li>if you have id data inside your grid you can use key column option (see <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options" rel="nofollow noreferrer">http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options</a>) to send id value only one time inside your JSON data.</li> <li>transfer date values in the most compact form yy-m-d and convert it in the text form which you want on the client side with respect of date-formatter.</li> <li>and so on</li> </ul> <p>but probably you want first of all to solve your main performance problem in your <strong>specific</strong> application. To be able to improve your specific application application you should post in your question more information about your solution:</p> <ul> <li>jqGrid definition inclusive the full colModel definition (not like in <a href="https://stackoverflow.com/questions/3049052/long-delay-between-serverside-json-and-jqgrid-loadcomplete-on-asp-net-mvc-site">long delay between serverside JSON and jqGrid loadComplete on asp.net mvc site</a>)</li> <li>a dump of data from <code>paginatedDat</code>a which you return as <code>Json(paginatedData)</code> or better your JSON data send to the client (you can copy the data from Fiddler <a href="http://www.fiddler2.com/fiddler2/" rel="nofollow noreferrer">http://www.fiddler2.com/fiddler2/</a> for example)</li> <li>version information of jqGrid, jQuery and jQuery UI which you use</li> <li>more information about your data model and database can be also helpful</li> </ul> <p>Without this kind of information you can spend your bounty without real benefit for you.</p> <p><strong>UPDATED 2</strong>: A practical example of optimization of JSON data you can find in <a href="https://stackoverflow.com/questions/3054463/jqgrid-3-7-does-not-show-rows-in-internet-explorer">Jqgrid 3.7 does not show rows in internet explorer</a></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