2

I have been using jqgrid for a long time with my asp.net MVC application

All of the sudden today IE is showing the Stop Running Script dialog saying

 A script on this page is causing your web browser to run slowly. If it continues to run, 
 your computer might become unresponsive.

I have narrowed it down to the code in which I am trying to reload the grid after some ajax runs.

If I take out the following

$("#shippingscheduletable").jqGrid().trigger("reloadGrid");

the dialog it not displayed, when I put it back it is there again. Nothing has changed on this application for months and it has worked just fine.

I have walked through the controller action that the jqgrid is bound to and it runs just fine, it doesn't get stuck in any loops or anything.

it does not show any errors at all in any other browser. Any thoughts on how to resolve it?

twal
  • 6,999
  • 17
  • 48
  • 58
  • 1
    Are you by chance using a fixed/specific jQuery version or the "latest" whenever that changes? – Mark Schultheiss Mar 01 '11 at 22:13
  • You nailed it! i am using the latest. which is 1.4.4. I forced it to be 1.4.2 and voila works just fine. Put your comment as an answer and I will give you credit for it. Thank You! – twal Mar 01 '11 at 22:15

2 Answers2

3

Correct usage of reloadGrid is

$("#shippingscheduletable").trigger("reloadGrid");

(see jqGrid documentation) and not

$("#shippingscheduletable").jqGrid().trigger("reloadGrid");

More sophisticated and less documented parameters of reloadGrid you will find in the answer.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks. making the change you recommended allowed it to work with 1.4.4. The way I was going it worked just fine with previous versions but not with 1.4.4. – twal Mar 01 '11 at 22:58
  • I have also noticed this "reduction" in IE speed when adding a feature to an element in recent versions during certain events. Better than my answer as it addresses the issue more directly instead of avoiding it :) – Mark Schultheiss Mar 02 '11 at 13:59
  • @Mark Schultheiss & @twal: I agree with you. The most problem with the speed are in the following places: 1) one don't use `gridview:true` 2) one use `afterInsertRow` which is evil. 3) one enumerate all rows with `getDataIDs()` and modify every row using `getCell`, `setCell` or `$('#'+rowid)`. I suggested more quick way [here](http://stackoverflow.com/questions/5010761/linking-from-a-column-value-in-jqgrid-to-a-new-page-using-get/5017528#5017528) – Oleg Mar 02 '11 at 14:25
  • @Mark Schultheiss & @twal: See also [the feature request](http://www.trirand.com/blog/?page_id=393/feature-request/new-events-to-simplify-to-change-grid-cells-as-dom-elements-or-to-make-grid-binding/) which I posted recently. – Oleg Mar 02 '11 at 14:26
1

Are you by chance using a fixed/specific jQuery version or the "latest" whenever that changes? Changes cause some IE implimentations to slow things down.

Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100