X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/examples/direct/direct.js?ds=sidebyside diff --git a/examples/direct/direct.js b/examples/direct/direct.js index e4a02195..a07ea7ad 100644 --- a/examples/direct/direct.js +++ b/examples/direct/direct.js @@ -1,88 +1,88 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license */ -Ext.onReady(function(){ - Ext.Direct.addProvider( - Ext.app.REMOTING_API, - { - type:'polling', - url: 'php/poll.php' - } - ); - - var out = new Ext.form.DisplayField({ - cls: 'x-form-text', - id: 'out' - }); - - var text = new Ext.form.TextField({ - width: 300, - emptyText: 'Echo input' - }); - - var call = new Ext.Button({ - text: 'Echo', - handler: function(){ - TestAction.doEcho(text.getValue(), function(result, e){ - var t = e.getTransaction(); - out.append(String.format('

Successful call to {0}.{1} with response:

{2}

', - t.action, t.method, Ext.encode(result))); - out.el.scroll('b', 100000, true); - }); - } - }); - - var num = new Ext.form.TextField({ - width: 80, - emptyText: 'Multiply x 8', - style: 'text-align:left;' - }); - - var multiply = new Ext.Button({ - text: 'Multiply', - handler: function(){ - TestAction.multiply(num.getValue(), function(result, e){ - var t = e.getTransaction(); - if(e.status){ - out.append(String.format('

Successful call to {0}.{1} with response:

{2}

', - t.action, t.method, Ext.encode(result))); - }else{ - out.append(String.format('

Call to {0}.{1} failed with message:

{2}

', - t.action, t.method, e.message)); - } - out.el.scroll('b', 100000, true); - }); - } - }); - - text.on('specialkey', function(t, e){ - if(e.getKey() == e.ENTER){ - call.handler(); - } - }); - - num.on('specialkey', function(t, e){ - if(e.getKey() == e.ENTER){ - multiply.handler(); - } - }); - - var p = new Ext.Panel({ - title: 'Remote Call Log', - //frame:true, - width: 600, - height: 300, - layout:'fit', - - items: [out], - bbar: [text, call, '-', num, multiply] - }).render(Ext.getBody()); - - Ext.Direct.on('message', function(e){ - out.append(String.format('

{0}

', e.data)); - out.el.scroll('b', 100000, true); - }); -}); +Ext.onReady(function(){ + Ext.Direct.addProvider( + Ext.app.REMOTING_API, + { + type:'polling', + url: 'php/poll.php' + } + ); + + var out = new Ext.form.DisplayField({ + cls: 'x-form-text', + id: 'out' + }); + + var text = new Ext.form.TextField({ + width: 300, + emptyText: 'Echo input' + }); + + var call = new Ext.Button({ + text: 'Echo', + handler: function(){ + TestAction.doEcho(text.getValue(), function(result, e){ + var t = e.getTransaction(); + out.append(String.format('

Successful call to {0}.{1} with response:

{2}

', + t.action, t.method, Ext.encode(result))); + out.el.scroll('b', 100000, true); + }); + } + }); + + var num = new Ext.form.TextField({ + width: 80, + emptyText: 'Multiply x 8', + style: 'text-align:left;' + }); + + var multiply = new Ext.Button({ + text: 'Multiply', + handler: function(){ + TestAction.multiply(num.getValue(), function(result, e){ + var t = e.getTransaction(); + if(e.status){ + out.append(String.format('

Successful call to {0}.{1} with response:

{2}

', + t.action, t.method, Ext.encode(result))); + }else{ + out.append(String.format('

Call to {0}.{1} failed with message:

{2}

', + t.action, t.method, e.message)); + } + out.el.scroll('b', 100000, true); + }); + } + }); + + text.on('specialkey', function(t, e){ + if(e.getKey() == e.ENTER){ + call.handler(); + } + }); + + num.on('specialkey', function(t, e){ + if(e.getKey() == e.ENTER){ + multiply.handler(); + } + }); + + var p = new Ext.Panel({ + title: 'Remote Call Log', + //frame:true, + width: 600, + height: 300, + layout:'fit', + + items: [out], + bbar: [text, call, '-', num, multiply] + }).render(Ext.getBody()); + + Ext.Direct.on('message', function(e){ + out.append(String.format('

{0}

', e.data)); + out.el.scroll('b', 100000, true); + }); +});