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로 시작하는 동안, 전 screencast 눈금을 본 사람이 오히려 의심스러운 방법을 사용하여 만들기를 ajax 실제 폼 요소를 사용하여 호출합니다. I hunted for a better option and I came across a better option - Ext.data.Connection. 나는 당신을 더 나은 옵션을 건너 온 더 나은 옵션 - ext.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.'); } }); 변수 conn = 새로운 ext.data.connection (); conn.request ((홈페이지 : '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. 안과에 맞게 이름을 변경하는 방법을 사용자의 요구 사항을합니다.
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.변수 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 () (경우 (레코드! = 널 & & 필드! = 널) (metaid = record.get ( "metaid"); grid.getgridel (). 마스크 ( '로드 중 역사 ...'); conn.request ((홈페이지 : '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 및 서비스는 도서관과 협력을 요청할처럼, 브라우저는 현재 진정으로 왕이합니다. You don't need desktop applications for most purposes. 데스크톱 응용 프로그램에 대한 대부분의 목적에 필요하지 않습니다.
Filed under 밑에 Ajax ajax , Browser 브라우저 , Headline News 헤드 라인 뉴스 , How To 하는 방법을 , Javascript 자바 스크립트 , Programming 프로그래밍 , Web 웹 , Web 2.0 웹 2.0 , Web Services 웹 서비스 | |
| |
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분
Ext kan eenvoudige zaken nog eenvoudiger maken. 내선 칸 eenvoudiger 노그 eenvoudige zaken 그걸합니다.
Je kan Ext.Ajax.request gebruiken om een 18 페이지 je 칸 ext.ajax.request gebruiken
call uit te voeren, is nog net iets korter dan de connection oplossing. 전화 uit voeren 소식은 단 드 연결을 노그 순수한 두거든 korter oplossing합니다.
Overigens gebruikt ook eens Ext.encode om 49 ext.encode 페이지 gebruikt overigens eens
je parms te encoderen, je parms 소식 encoderen,
March 11th, 2008 at 4:09 pm 2008년 3월 11일에서 오후 4시 9분
Thank you very much! 진심으로 감사합니다! After much digging around (including extjs.com), that\\\’s exactly what I need. 이후 많은 찾다 (extjs.com), 그 \ \ \ '의 정확히 내가이 필요합니다.