EasyUI Forum

General Category => Bug Report => Topic started by: josellm on April 10, 2013, 09:02:21 AM



Title: Datagrid load cancelled on IE9
Post by: josellm 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



Title: Re: Datagrid load cancelled on IE9
Post by: stworthy 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>