In EasyUI datagrid fails the reload solution under ie

  • 2020-05-12 02:10:28
  • OfStack

The problem

Recently, I used EasyUI to develop background system. During testing, I found a weird problem, $('dg').datagrid('reload'); When the table data is reloaded, the next point of ie does not respond. It turned out that it wasn't that there was no response, but that the browser was using a cache.

The solution

Internet users summed up the solution has the following:

1. Time stamp url, so that the first load and url accessed in reload are different from each other, so that the system cannot use IE cache. Through testing, it was found that the EasyUI request was followed by a random number _145232xxx, but ie still USES the cache. Then I added url to rand=xxx(Math.rand ()) in the requested js, and I did not use the cache. (I tested from ie8 to ie11)

2. Use as in < head > To add < meta > To clear the cache:


<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

Unfortunately, like many netizens, I failed in this method. : (

3. Declare method corresponding to load of datagrid as' POST'. This is the fastest solution. But there are a few problems:
The & # 8226; If the server interface does not support POST, it will be useless.
The & # 8226; If the server interface could be controlled by itself, such a compromise for the front end would result in the interface not even at 1 point. Keep in mind that the RESTful interface is basically designed in GET mode for queries.

conclusion

So is 1 kind of method, in adding random Numbers to use url himself, forgive I don't want to change the server interface code cleanliness _ _ (: з "<).


Related articles: