2016-05-13 101 views
0

我想向sap.ui.unified.MenuItem添加一個額外的文本屬性。它目前只有一個文本屬性。擴展標準UI5控件

我想下面

 sap.ui.unified.MenuItem.extend("ExtendedMenuItem",{ 
      metadata:{ 
       properties:{ 
        SetText : {type: "string"} 

       }, 
       aggregations: { 
        _SecondText : {type: "sap.ui.commons.Label", multiple : false, visibility: "public"} 
       } 
      }, 
      init: function(){ 
       var oSecondText = new sap.ui.commons.Label("TL",{ 
        text: this.SetText 
       }); 
       this.addAggregation("_SecondText",oSecondText); 
      }, 
      renderer:"sap.ui.unified.MenuItemRenderer" 
     }); 

     var oTestCopy = new ExtendedMenuItem("TC",{ 
      text: "TEST COPY", 
      SetText: "CTRL+TEST" 
     }); 

,但沒有被顯示在第二個文本屬性。 我能做些什麼來添加第二個文本屬性到標準的UI5控件?

回答

0

Here是自定義控制器官方文檔中的一個示例。您必須自己實現渲染器才能在用戶界面上放置新的m.Label元素。在渲染器中,您可以使用標準的HTML元素進行操作。有關更多詳細信息,請檢查鏈接的來源。