|
|||||||
![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
ext-basex 4.0 available.
ext-basex 3.0 (and above) is now available on Google Code (SVN). A demonstration of ext-basex/$JIT in action. Ext-Base adapter extensions v2.3 (LGPL), 3.x (GPL). The attached script file adds:
Ext.lib.Ajax. New config options (can be passed down from a higher level (ie. Ext.data.Connection) implementation.): { async : true/false, // Synchronous Request support. userId: 'JohnDoe', // HTTP Authentication available on each request password:'inTheClear', queue : {name: 'chat', priority : 1 } //dynamic queue creation } Ajax Requests can also be made without a web-server (ie local file systems) via HTTP-Status-200 emulation. Ext.lib.Ajax joins the Ext Event system (implements util.Observable). The following events added: request - (cancellable) Raised just before any passed headers, post content have been serialized. beforesend - (cancellable) Raised just after all headers, parameters, and content have been serialized and just before the XHR.send occurs. response - (cancellable) Raised after any response is received, but before any of the success/failure callbacks are made. (Use this to intercept each response for debugging, etc) exception - (cancellable) Raised after any non-successful HTTP status is recieved, but before any of the other internal success/failure callbacks are made. abort - Raised any time a forceful abort is issued timeout - Raised any time an asynchronous request times out. readystatechange - Raised each time the XHR objects' readyState changes status:n - Raised anytime a specific httpStatus is returned by the requested server onStatus/unStatus Event methods. Specific HTTP Status codes may be trapped via cancelable eventListeners. Returning false from an onStatus Handler prevents further function calls/events from being made by the Ajax request stack. Ext.lib.Ajax.onStatus([403,401],sessionTimeoutHandler,myApp) Ext.lib.Ajax.on('status:403', sessionTimeoutHandler, myApp);
For IE7, optionally force the older ActiveX XMLHttpRequest implementation (permits local file access for IE7). Ext.lib.Ajax.forceActiveX = true; Ext.lib.Ajax.encoder = escape; or Ext.lib.Ajax.encoder = myEncoderFn; //function that returns an encoded string Proper library placement is key. In order for lib.Ajax to get Observable support, ext-basex.js must be placed after the ext-base.js adapter and the Ext javascript module that provides Ext.util.Observable. For most installations, this will be either ext-all[-debug].js or ext-core.js. Including it before these modules (although fully functional) will not permit lib.Ajax to generate the events described above. <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Your Page for ExtJs 2.0</title> <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" /> <script type="text/javascript" src="../adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../ext-all.js"></script> <script type="text/javascript" src="../ext-basex.js"></script> </head> var log = Ext.log;
var AjaxDebugger = {
request: function( connection, method, url, callback, postData, options ){log(['request',url,postData]);}
,response: function( connection, response, callback, isAbort) { log(['response',response.responseText]);}
,exception: function( connection, response, callback, isAbort) { log(['HTTPException', connection.fullStatus.statusText ]);}
,abort : function(){log('Request was aborted');}
,timeout : function(){log('Request timed out');}
,readystatechange : function(connection){ log('readystatechange', connection.conn.readyState);}
};
Ext.lib.Ajax.on(AjaxDebugger );
Ext.lib.Ajax.suspendEvents() / resumeEvents() to suppress/enable events.
lib.Ajax Request Queues[ new for 2.3 ]. Ajax requests can now be made with named queues; each with specific execution priority. See this post for more details. Global forEach iterations: forEach([1,2,3],console.log); or [1,2,3].forEach(console.log); //Gecko already has the later form.
forEach(object,console.log);
"This is a test".forEach(console.log); or forEach("This is a test",console.log); //character enumeration
[Update] 11/10/2008 -- ext-basex 3.1 now: -- includes $JIT. Read more about it here. -- adds Ext.clone(deep) method. Clone anything (string, number,date, arrays, even complex objects)! -- new Array prototypes: atRandom, unique, map, include, filter, compact, flatten, forEach, clone [Update] 6/3/2009 -- ext-basex 3.4RC1 (for Ext 2.x, 3.x) is now available. See the Ext 3.0 extensions thread for more on new features. [Update] 10/28/2009 -- ext-basex 4.0 and $JIT 1.2 are now shipped with debug versions, jsb2 build support, and Ext Core 3 compatibility. Update: A quick Tutorial on how to use $JIT is also available here. Download Note: the current vBulletin config gzips attachments which IE hates. Download this with Firefox (or other browser) instead of IE.
__________________
Doug Hendricks Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site, donate. Last edited by hendricd; 11-18-2009 at 11:39 AM.. Reason: 4.0/$JIT released |
|
#2
|
|||
|
|||
|
Good !
I if can add a suggestion :
|
|
#3
|
||||
|
||||
|
@tof - Yes, although that is for (Ext.data.Connection) the next-level up in the stack, it's a useful addition (also found here).
__________________
Doug Hendricks Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site, donate. |
|
#4
|
|||
|
|||
|
Great stuff! I think this will come in handy.
__________________
Brad Baumann |
|
#5
|
||||
|
||||
|
Excellent work!!
@Ext team: Part of this features will be included in future versions of Ext? Thanks for share!! |
|
#6
|
||||
|
||||
|
Thanks, this is proving to be both useful and necessary for handling session timeouts... great!
... only problem I foresee is having to recode if this stuff gets in to Ext 2+... well such is life. PS Doug - have you always coded with preceding commas? Just a minor annoyance, To each their own! |
|
#7
|
||||
|
||||
|
Doug -
I'm trying to override the default behavior on a single request Doing this doesn't seem to work: Ext.lib.Ajax.onStatus([403,401],sessionTimeoutHandler,myApp) later: Ext.lib.Ajax.unStatus([403,401]) //didn't fix it Ext.lib.Ajax.onStatus([403,401],anotherTimeoutHandler,myApp) still calling sessionTimeoutHandler ... Any idea why? |
|
#8
|
||||
|
||||
|
You'll need to treat it like any other 'un':
Ext.lib.Ajax.unStatus([403,401],sessionTimeoutHandler,myApp) ![]()
__________________
Doug Hendricks Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site, donate. |
|
#9
|
||||
|
||||
|
Thanks, thought it might be something like that.
|
|
#10
|
|||
|
|||
|
What a great utility - thanks for making it available. This is exactly what we needed!
|
![]() |
| Tags |
| $jit, ajax, basex, capabilities.has, clone, ext-basex, foreach, jit, jsonp, multipart, mxhr |
| Thread Tools | |
|
|