2015-01-28 5 views
1

SAPUI5 컨트롤 GenericTile을 사용하고 headerImage 및 click 이벤트를 모두 추가했습니다. 이 아이콘을 클릭하면 타일의 이벤트 핸들러가 먼저 트리거되므로 아이콘 클릭 자체에 반응 할 수 없습니다 (당연히 다른 작업을 수행해야 함).SAPUI5 : 클릭 이벤트 올바르게 처리

var oGenericTile = new sap.suite.ui.commons.GenericTile({ 
       frameType: "TwoByOne", 
       header: "My HEader", 
       headerImage: "sap-icon://settings", 
       tileContent: oTileContent 
      }); 

oGenericTile._oImage.attachPress(function(oEvent) { 
       sap.m.MessageToast.show("Icon has been pressed"); 
       oEvent.cancelBubble(); 
       oEvent.preventDefault(); 
      }); 

      oGenericTile.attachPress(function() { 
       sap.m.MessageToast.show("I am always triggered first!!! :-("); 
      });` 

어떻게하면이 문제를 피할 수 있습니까?

감사 톤,

안톤

+1

당신은 즉', 자신의 컨트롤과 함께'sap.suite.commons.GenericTile'을 확장 my.GenericTile' 필요와'my.GenericTile.prototype.onclick/ontapstart' 메소드를 오버라이드 (override). –

답변

1

당신은 예를 들어, 수 또한이 동작을 피하기 위해 수동으로 타일의 이벤트를 취소하면 JSBin의 간단한 예제를 참조하십시오. JSBin의 간단한 예제를 참조하십시오. http://jsbin.com/daqifomoge/3/edit

기존 컨트롤 확장 및 메서드 재정의 원래 컨트롤이 개발자로부터 업데이트를 얻을 때 항상 깨뜨릴 잠재력을 가지고 있습니다 ...

더 우아한 방법이 있습니다.

최저

, 크리스티안은

관련 문제