OnStart/OnComplete イベントのタイプアヘッド

/***
 *** OnStart/OnComplete イベントのタイプアヘッド
 *** 
 *** CSJSのスクリプトブロックで実装してください
 ***/
 
 
var typeAheadLoad;
 
dojo.addOnLoad( function(){
 
   /*** hijacking xhr request ***/
   if( !dojo._xhr )
      dojo._xhr = dojo.xhr;
 
   dojo.xhr = function(){
      try{
         var args = arguments[1];
         if( args['content'] ){
            var content = args['content'];
               if( content['$$ajaxmode'] ){
                  if( content['$$ajaxmode'] == "typeahead" ){
                 
                     /*** hook in load function ***/
                     typeAheadLoad = args["load"];
 
                     /*** overwrite error function ***/
                     args["error"] = function(){
                        alert('Error raised!')
                     };
                     
                     /*** hijack load function ***/
                     args["load"] = function(arguments){
                  
                        /*** On Start ***/
                        alert("On Start!");
                     
                        /*** call original function ***/
                        typeAheadLoad(arguments);
                     
                        /*** On Complete ***/
                        alert("On Complete!")
                     };
                 }
             }
         }
      }catch(e){}
      dojo._xhr( arguments[0], arguments[1], arguments[2] );
   }
});





XPages のタイプアヘッド機能を OnStart/OnCompete イベントで実行できるようにコードを追加するものです。

JavaScript (Client)
katoman
July 1, 2015 at 4:58 PM
Rating
0





No comments yetLogin first to comment...