How To Make AJAX Calls With ExtJS Easily ajax extjsの作り方を簡単に電話をかける
Simple things should be simple.単純なことは簡単です。 While starting with ExtJS, I saw a screencast on Grid which used a rather dubious method of making an AJAX call using an actual form element. extjs中で始めると、スクリーンキャストを見ましたグリッドを用いて、やや怪しげなajaxのメソッド呼び出しを使用しており、実際のフォーム要素を作成します。 I hunted for a better option and I came across a better option - Ext.data.Connection.私は、より良いオプションを選択し、狩りの途中で、より良いオプション-e xt.data.connectionです。 Here’s an working example on how you can easily make AJAX call in ExtJS library.ここに作業の例をどのように請求することができます。 ajax extjsライブラリを簡単に行う。
var conn = new Ext.data.Connection(); conn.request({ url: 'history.jsp', method: 'POST', params: {"metaID": metaID, columnName: field}, success: function(responseObject) { showHistoryDialog(responseObject.responseText); }, failure: function() { Ext.Msg.alert('Status', 'Unable to show history at this time. Please try again later.'); } }); var conn =新しいext.data.connection ( ) ; conn.request ( (のURL : ' history.jsp ' 、メソッド: 'ポスト' 、パラメータ: ( " metaid " : metaid 、 columnname :フィールド) 、成功:関数( responseobject ) ( showhistorydialog ( responseobject.responsetext ) ; ) 、失敗:関数( ) ( ext.msg.alert ( '状態' 、 'この時点での履歴を表示できません。後ほどお試しください。 ' ) ; ) ) ) ; Obviously you will have to implement the showHistoryDialog() method to your taste.明らかにshowhistorydialogを実装する必要があります( )メソッドをして味です。 Change the method names and url to suit your requirements.メソッドの名前とURLを変更してスーツにお応えします。
The downside is that it doesn’t display a loading message which you can easily implement.の下げは、それを読み込んでいますが表示されないメッセージが表示さを簡単に実装することができます。
Update:更新日:
Here is the full code showing a Loading dialog too:ここで表示中の完全なコードを読み込んでいます]ダイアログあまりにも:
var conn = new Ext.data.Connection(); // History buton click handler.var conn =新しいext.data.connection ( ) ; / /履歴butonハンドラをクリックします。It submits the request and displays the response using history dialog function showHistory() { if(record != null && field != null) { metaID = record.get("MetaID"); grid.getGridEl().mask('Loading history...'); conn.request({ url: 'history.jsp', method: 'POST', params: {"metaID": metaID, columnName: field}, success: function(responseObject) { showHistoryDialog(responseObject.responseText); grid.getGridEl().unmask(true); }, failure: function() { grid.getGridEl().unmask(true); Ext.Msg.alert('Status', 'Unable to show history at this time. Please try again later.'); } }); } }提出の要求に応答し、表示する関数を使用して履歴]ダイアログshowhistory ( ) (もし(レコード! = nullが& &フィールド! = nullが) ( metaid = record.get ( " metaid " ) ; grid.getgridel ( ) 。マスク( '読み込んでいます履歴...'); conn.request ( (のURL : ' history.jsp ' 、メソッド: 'ポスト' 、パラメータ: ( " metaid " : metaid 、 columnname :フィールド) 、成功:関数( responseobject ) ( showhistorydialog ( responseobjectです。 responsetext ) ; grid.getgridel ( ) 。正体を現す(真の) ; ) 、失敗:関数( ) ( grid.getgridel ( ) 。正体を現す(真の) ; ext.msg.alert ( '状態' 、 'を表示する歴史できませんでした。この時期です。お試しください。 ' ) ; ) ) ) ; ) )
Note: The code is used in a production environment to display historical information.注:上記のコードで使用されて、本番環境を表示する歴史的な情報です。 The server side code as well as the implementation of of showHistoryDialog() is not provided as it is irrelevant to the context.サーバー側のコードだけでなく、実装のshowhistorydialog ( )ではないことは不適合を提供されているコンテキストです。
With libraries like ExtJS and services like GMail, browser is now truly the king.をライブラリにextjsやサービスのようにGmailのように、ブラウザは、現在真にザキングします。 You don’t need desktop applications for most purposes.デスクトップアプリケーションの必要はありませんほとんどの目的です。
Filed under提出されて Ajax ajax , 、 Browserブラウザ , 、 Headline Newsニュースの見出し , 、 How Toどのように , 、 Javascript JavaScriptの , 、 Programmingプログラミング , 、 Webウェブ , 、 Web 2.0ウェブ2.0 , 、 Web Services Webサービス | |
| |
RSS 2.0 RSS 2.0を | |
Trackbackトラックバック this Article |この記事|
Email this Article電子メールこの記事
You may also like to readを読むようにすることも可能 |




August 27th, 2007 at 2:13 am 2007年8月27日2:13 AMの
Ext kan eenvoudige zaken nog eenvoudiger maken.内線館eenvoudige zaken nog eenvoudiger maken 。
Je kan Ext.Ajax.request gebruiken om een会社はgebruiken館ext.ajax.request een
call uit te voeren, is nog net iets korter dan de connection oplossing.コールuit te voerenは、当期純nog iets oplossing korterダンデ接続します。
Overigens gebruikt ook eens Ext.encode om gebruikt overigens ook eens ext.encode会社
je parms te encoderen, parms te encoderenは、
March 11th, 2008 at 4:09 pm 2008年3月11日は4:09 pmの
Thank you very much!本当にありがとうございます! After much digging around (including extjs.com), that\\\’s exactly what I need.掘削した後くらい周り( extjs.comを含む) 、その\ \ \ '秒丁度私が必要とします。