gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

Add feature to avoid request submission in onBeforeTopics callback for grid plugin #901

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The original jqgrid event loadBeforeSend allows user to return false to abort 
the request. This can be useful for some extra checking including tricks to 
abort initial grid load. (ref. http://stackoverflow.com/questions/3934629/ )

This can be achieved by modifying the file jquery.grid.struts2-3.3.0.js in 
struts2-jquery-grid-plugin-3.3.0.jar starting from line 173 to

            if (o.onbef) {
                params.loadBeforeSend = function(xhr) {

                    var orginal = {};
                    orginal.xhr = xhr;
                    orginal.proceed = true;

                    self.publishTopic($elem, o.onalw, orginal);
                    self.publishTopic($elem, o.onbef, orginal);

                    return orginal.proceed;
                };
            }

So in our onBeforeTopics callback function, we can abort the request by setting 
event.originalEvent.proceed = false;

Which struts2 version?
2.3.1.2

Which struts2-jquery plugin version?
3.3.0

Original issue reported on code.google.com by quincyle...@gmail.com on 12 Oct 2012 at 6:35

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 12 Oct 2012 at 7:09

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/struts2-jquery/source/detail?r=1732

Original comment by johgep on 12 Oct 2012 at 7:35

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 15 Oct 2012 at 6:46