Table is unexpectantly re-initialized only in IE

Table is unexpectantly re-initialized only in IE

tbeaulieutbeaulieu Posts: 5Questions: 0Answers: 0
edited March 2011 in General
Two solid days and counting ... Finally narrowed it down ...

While sitting on an MVC3 View that was redirected from a submit (I know ...) if I call into the table's fnDraw function, immediately after the table goes through its gyrations and the ajax (server side) call is made, just when I'd expect to see the call return, the global code in jquery.dataTables.js is executed and the table to be re-initialized! The first ajax call never completes and a second is submitted, resulting in overlapping calls. Often, the first call does return (as far as the controller is concerned, but nobody seems to be listening any more.

This does not happen in FireFox!

Why would IE execute the global js on the page? Do I somehow need to wrap all that startup code in a conditional?

Thanks for any suggestions.

Replies

  • tbeaulieutbeaulieu Posts: 5Questions: 0Answers: 0
    Oh my, this just keeps getting better. After adding 1,723 console.log() calls in the datatable js, I feel close, but still without a solution.

    For some reason, immedaitely upon returning from the call to fnDraw (which in turn calls fnServerData), IE seems to be reloading the page. I may be using bogus terminology, as I'm new to web dev. A hook to window.unload gets called then a hook to document.ready is called.

    I discovered that this is only happening after the redirect and the window.location.hash is changed.

    In other words, another page redirects me into this view with a hash that I use to initialize the table with. I then call into fnDraw (because I click an option that affects the table redraw) and upon returning from that call, it's toast. If I then let it proceed, reloading the table from scratch, I can call redraw w/o issue.

    Just so bizzarre. And time consuming!
  • tbeaulieutbeaulieu Posts: 5Questions: 0Answers: 0
    Found it. Don't change the url, even the hash when using ajax. IE gets grumpy.
This discussion has been closed.