Scripter/EXTJS

Ext.Updater 깜빡거림 방지

데꾸벅 2009. 5. 6. 20:07


ext-js 2.x 이상 버전에서 Updater를 이용시 깜빡거릴 경우가 있다.
이는 로딩인디케이터 때문인데 이럴 경우에는 다음과 같이 처리해주면 깜빡거리지 않는다.
아래 소스는 ext2.2 버전에서 테스트한 경우이다.

참조 URL : http://extjs.com/deploy/dev/docs/output/Ext.Updater.html

<html>
<head>
 <title>Ext JS 2.2 Samples</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<script type="text/javascript" src="../lib/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../lib/ext-2.2/ext-all.js"></script>
<body>

<div id="specialDiv" style="border:solid 1px black;width:300px;height:300px"></div>
<button onclick="testFunc('start')">오토 시작</button>
<button onclick="testFunc('stop')">오토 끝</button><span id="techbugNo"></span><br />

<button onclick="testFunc1()">클릭할때마다 시작</button>


<script type="text/javascript">

 function testFunc(a){
  var mgr = new Ext.Updater("specialDiv");
  mgr.showLoadIndicator = false;  <-- 깜빡거림 방지
  if(a=='start'){
   mgr.startAutoRefresh(1, {
    url: "test1.html",
    method: "post",
    scripts: true,
    refreshNow : true,
    callback : function(){

    }
   });
  }else {
   //IE6이상버전에서 이상하게 작동하지 않음! 소스를 까봐야 겠음!
   mgr.stopAutoRefresh();
  }

  var techbug =0;
  mgr.on("update",function(){
   Ext.get("techbugNo").update(techbug++);
  });
 }

 function testFunc1(){   
  Ext.get("specialDiv").load({    //보통은 load로 처리하여 요기를 Updater로 사용하는것이 바람직
         url: "./test1.html",
         scripts: true,
         params: "",
         text: "Loading Foo..."
    });

 }
</script>
</body>
</html>


IE7, Chrome, FF3, Opera9.64 에서 테스트결과