Hybrid View
-
11 Mar 2012 8:09 PM #1
Does the CORS option in Ext.data.Connection v4.0.7 actually work?
Does the CORS option in Ext.data.Connection v4.0.7 actually work?
It is clear the code was never tested as it has a basic error (Uses Ext.isIe instead of Ext.isIE), but if I manually fix that is it actually useable? My tests indicate that answer is no so-far.
The success handler is never called. Instead, the request times out and the failure is called. This is despite the developer tools in IE9 showing the request succeeded. Does this feature work?Code:Ext.isIe = Ext.isIE; Ext.Ajax.request({ method: 'GET', cors: true, params: { format: 'json' }, url: 'http://some.random.domain/restaurants', success: function(response) { var results = Ext.decode(response.responseText); Str.Restaurant = results['Restaurants'][0]; Str.store.RestaurantLocations.loadData(Str.Restaurant['Locations']); Str.restaurantPanel.update(Str.Restaurant); win.show(); myMask.hide(); }, failure: function(response) { myMask.hide(); Ext.Msg.show({ title: 'Booking Time Error', msg: 'There was an error fetching the Restaurants from the server.\n\nReservation system won\'t be available.', buttons: Ext.Msg.OK, icon: Ext.Msg.ERROR }); } }); });
-
12 Mar 2012 11:13 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
That is a bug and has been fixed in 4.1.0 beta 3 but I can confirm that it does work when that is fixed.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Mar 2012 3:02 PM #3
Every indication I have is that even in beta3 it doesn't work. My failure still gets run in IE9 after the CORS request succeeds. There are no JavaScript errors and the request works in Firefox, Chrome and Safari. Even this simple example fails in IE:
In Firefox, Safari and Chrome this gets an alert that says "success" almost immediately. In IE9, it gets a "failed" after a decent delay. You can see this example running on a live site with a CORS compatible URL here.Code:Ext.onReady(function() { Ext.Ajax.request({ method: 'GET', cors: true, params: { format: 'json' }, url: 'http://xxxx:9200/restaurants/101', success: function(response) { alert('success'); }, failure: function(response) { alert('failed'); } }); });
Has this definitely been tested and is definitely working?
-
12 Mar 2012 7:10 PM #4
To say that I am a little frustrated right now is an understatement. This code was obviously never tested - EVER - because it will just plain not work for IE.
Line 52310 of ext-all-sandbox-debug-w-comments.js of 4.1beta3 reads as follows:
The XDomainRequest object used by Microsoft doesn't have such an event. It's events are onerror, onload, onprogress and ontimeout as described here. THIS CODE COULD NEVER OF WORKED!Code:xhr.onreadystatechange = Ext.Function.bind(me.onStateChange, me, [request]);
Is it any wonder that the current state of ExtJS 4 is in complete disarray. First you use Ext.isIe instead of Ext.isIE, then you are trying to bind to events that don't even EXIST!This is basic stuff! Just testing this code once will have shown this error. Seriously, JUST ONCE!
If there is code like this in such a core part of the framework that has not been run or tested then it begs the question what else is hiding in ExtJS 4? It begs an even bigger question of me - how was I tricked into paying for this.
-
13 Mar 2012 12:10 AM #5
Do you want me to move this thread to Bugs so that developers can fix it before the Ext 4.1 final is out?
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
13 Mar 2012 4:37 AM #6
If you think there is any chance that it will be fixed by 4.1 then yeah, go for it.
You found a bug! We've classified it as
EXTJSIV-5799
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.



Reply With Quote