EasyUI Forum
May 08, 2024, 02:51:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid load cancelled on IE9  (Read 11151 times)
josellm
Newbie
*
Posts: 1


View Profile
« on: April 10, 2013, 09:02:21 AM »

Hi!

I have a datagrid loaded from a click in a listitem, on IE9 the datagrid is not loaded because the ajax request is cancelled.

http://stackoverflow.com/questions/7577275/jquery-ajax-requests-are-getting-cancelled-without-being-sent
http://stackoverflow.com/questions/10990607/jquery-ajax-post-canceled

A workaround is execute the ajax query syncronous. I modified jquery.easyui.min.js setting async=false from a grid option:

Ln.8473 $.ajax({type:opts.method,url:opts.url,data:_629,dataType:"json",success:function(data){
Ln.8473 $.ajax({type:opts.method,url:opts.url,data:_629,dataType:"json",async:!opts.sync,success:function(data){

Can you give me a better solution?

Thanks and best regards,
Jose

Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 11, 2013, 07:23:02 PM »

To execute an syncronous query on datagrid, override the 'loader' is a better way.
Code:
<script>
$.fn.datagrid.defaults.loader = function(param, success, error){
var opts = $(this).datagrid('options');
if (!opts.url) return false;
$.ajax({
type: opts.method,
url: opts.url,
data: param,
dataType: 'json',
async:!opts.sync,
success: function(data){
success(data);
},
error: function(){
error.apply(this, arguments);
}
});
};
</script>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!