问题
In my last project I've used jqGrid 3.8.2, jQuery 1.4.4 and jquery-ui-1.8.10. The company I work for still uses IE8 as a web broswer so in my development I always test with that platform. I've noticed today that a jqGrid is rendered properly when I test everything on my machine (winXP) using the Visual Studio (2010) ASP.NET Development Server:
As you can see the selection is perfect and the header is ok.
When I copy everything on the production server (Win 2003 + IIS6.0) the same form renders in a funny way.
As you can see now the row selection is not working properly and I've got these strange arrows in the header. PS: I am using the same computer and browser to render the same page. PPS: Obviously, if I use a different (professional ;-) ) browser (mozilla, safari, opera, chrome) everything works properly.
回答1:
For some strange reason IE8 sets the "compatibility view" for all the intranet sites:
So I couldn't see the "compatibility view" button next to my URL bar.
I had to go to Tools - Compantibility View Settings and uncheck the flag "Display intranet sites in Compatibility View".
No my site (intranet site) is shown in standard mode and everything works as expected.
Thanks Microsoft cause, once again, I've wasted a few hours for your silliness.
UPDATE
As Oleg suggested you can add these tags to your configuration file (ASP.NET and MVC):
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=8" />
</customHeaders>
</httpProtocol>
...
</system.webServer>
but this only works in IIS7 cause <system.webServer>
is not used by IIS6.
A better way to achieve the same results - and it works for me - is to put a META tag in the master page in the HEAD section:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
I've tested it and it works even if you have "Display intranet sites in Compatibility View" active.
回答2:
It looks much more as the error in deployment. I mean that either some files (for example from the images
subdirectory of the jQuery UI) are not copied or copied or you use somewhere somewhere absolute and not relative paths. So some files could not be found after the deployment on the server.
You can try to use Fiddler or Firebug to see which files could not be loaded during the page loding.
来源:https://stackoverflow.com/questions/5262775/jqgrid-and-compatibility-view-mode-in-ie8