-
29 Sep 2010 6:52 AM #1
Ext.Direct Exceptions and Events
Ext.Direct Exceptions and Events
Hi,
Ext.Direct is a wonderful method to interact with the server side, but I have a few questions about things I cannot found in the source.
1) In Direct.js I found:
What does this mean? What can I do with it?Code:exceptions: { TRANSPORT: 'xhr', PARSE: 'parse', LOGIN: 'login', SERVER: 'exception' }
2) With something like
I can react onto server side events. But how can I produce a server side event. The special case of an exception is no problem: throw new exception ...Code:Ext.Direct.on('info', function(e) { Ext.Msg.alert('Info: ' + e.data); });
But what is to do with other events?
3) Is it possible to initiate a server side event out of a php script called by cron?
4) Is there already a useful login method? I think about following situation: A session may be timed out, but this should not end in loosing data, which was not saved. So if an Ext.Direct call is make for doing something on the server and the session is timed out, on client side should appear a login window. If the user logged in successfully, the last call to the server should be repeated. So it is a transparent login system: the application itself is not disturbed when the user is able to continue the session with correct password (changing the username should not be possible). If nothing exists till now, has anyone an idea, how to solve this?
Greetings,
Wolfgang
-
29 Sep 2010 11:58 AM #2
1) no idea
2) You can catch anything you want with this. particulary :
so this specialized functions handle every special type of "event". Now the server direct request handler normaly must be able to answer several "transactions" in one request (couple of stores refreshing, on update). In my case these "msg" or "timeouts", are "created" and added as a response to the request, whenever it's necessary because it's in their nature to "not be expected".Code:Ext.Direct.on('timeout', onShowLoginFormToDoNotLoseCurrentChanges); Ext.Direct.on('msg', displayMsgThatComesInDataField); Ext.Direct.on('trace', ifYouAreADeveloperShowThisInAAlertMsgOrWhathever);
So, to me, they are some kind of "core" msg system between the server side app and the client side app.
example msg:
3) From what I see you can't. The client must request something to communicate with him, http is not a persistent connection. but you can create a PollingProvider to keep in touch, anything new can be add there.Code:{type : 'event', name : 'msg', data : 'Some Important Data'} {type : 'event', name: 'trace', where : 'Where this XXXX happen', trace : 'Some important debug data like a dump'} {type : 'event', name: 'bunnyjump', anything : 'dummy', goesHere : 'you can create you custom data depending what you need'}
4) there you go. In number 2) I kind of answered that. But it's up to you basically.
Cheers
Israel.Last edited by kodomo; 29 Sep 2010 at 12:06 PM. Reason: name
-
8 Oct 2010 1:32 AM #3
We use exceptions to debug from php.
Code:Ext.Direct.on("exception", function(event) { var backtrace = ""; if (event.where) { backtrace = "<p style=\"margin-top: 20px;\">" + "<strong>Backtrace:<\/strong><br \/>" + event.where.replace(/#/g, "<br \/>#") + "<\/p>"; } extDirectDebug( "<p>" + event.message + "<\/p>" + backtrace, event.method, "ExtDirect - Exception" ); }); Ext.Direct.on("event", function(event, provider) { if (typeof event.debug !== "undefined" && event.debug !== "") { extDirectDebug(event.debug, event.method, "ExtDirect - Debug"); } });vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
10 Oct 2010 4:53 AM #4
Have you code for 'extDirectDebug'?
-
10 Oct 2010 7:03 AM #5
sure, though it's only the output, depends on the environment.
Code:var extDirectDebug = function(message, header, group) { var TYPO3ViewportInstance = null; if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") { TYPO3ViewportInstance = top.TYPO3.Backend; } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") { TYPO3ViewportInstance = TYPO3.Backend; } if (TYPO3ViewportInstance !== null) { TYPO3ViewportInstance.DebugConsole.addTab(message, header, group); } else if (typeof console === "object") { console.log(message); } else { document.write(message); } };vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
Similar Threads
-
Ext.Direct.exceptions.LOGIN : 'login'
By bareflix in forum Ext.DirectReplies: 0Last Post: 18 Aug 2010, 1:23 PM -
Simple Ext.Direct-Combobox plugin --- with Ext.Direct.Store for reuse
By xp743 in forum Ext 3.x: User Extensions and PluginsReplies: 1Last Post: 26 Jul 2010, 11:56 AM -
[OPEN-964] Ext.Direct and exceptions
By stever in forum Ext 3.x: BugsReplies: 0Last Post: 13 May 2010, 7:34 PM -
events: connection exceptions, chaining events & canceling
By end-user in forum Ext 2.x: Help & DiscussionReplies: 11Last Post: 10 Jul 2008, 10:31 AM -
Ext.Toolbar causing DOM Exceptions in Firefox
By chris in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 19 Apr 2007, 1:53 AM


Reply With Quote