javascript - How to implement a CustomTile that can be consumed by sap.m.TileContainer in SAPUI5? -


I have increased the "custom tile" with some other controls and planned to use it in tile container. Example code for new tile:

  jQuery.sap.declare ("xyz.control.MySpecialTile"); JQuery.sap.require ("sap.m.CustomTile"); Sap.m.CustomTile.extend ("xyz.control.MySpecialTile", {Metadata: {properties: {"icon": {type: "string", defaultValue: "sap-icon: // shipping-status"}}, }, // will be said during creation time: function () {this.addStyleClass ("some style"); var oCont = ... some content created with other controls ... this.setContent (oCont);} , Renderer: {}, on-premise: function () {}}); Var oFunctions = new sap.m.TileContainer ({width: "100%", // sap.ui.core.CSSSize height: "100%", // sap.ui.core.CSS Size tiles: [oCustomTile1, oCustomTile2 , Omespastile], // sap.ui.core.Control});  

Where: oCustomTile1 and oCustomTile2 Certain standard custom tiles and omespace tile is an example of my own tile.

If I take "Omishishish tile" in any page, it will be shown, but if I put it in tile containant (code), then this tile will be hidden.

The question is, is there a problem in my code or is it a bug in the tile container? Can I assume that the tile container examines the type of elements and does not know my "new" class?

My general idea is, to make a custom tile with some defined content structure and certain attributes can be defined through binding.

You must call the base onAfterRendering function sap.m. CustomTile :

  On-the-Operating: function () {sap.m.CustomTile.prototype.onAfterRendering.call (this); }  

Please check and run the code snippet.

  & lt; Script src = "https: //openui5.hana.ondemand .com / resources / sap-ui-core.js" id = "sap-ui-bootstrap" Data-SAP-UI-Theme = "sap_bluecrystal" Data-SAP- Ui-libs = "sap.m" & gt; & Lt; / Script & gt; & Lt; Script & gt; JQuery.sap.declare ("xyz.control.MySpecialTile"); JQuery.sap.require ("sap.m.CustomTile"); Sap.m.CustomTile.extend ("xyz.control.MySpecialTile", {Metadata: {properties: {"icon": {type: "string", defaultValue: "sap-icon: // shipping-status"}}, }, // will be said during creation time: function () {sap.m.CustomTile.prototype.init.call (this); this.addStyleClass ("someStyle"); var oCont = new sap.m.Button ( {Text: "My custom tile 2"}); // ... some content build with other controls ... this.setContent (oCont);}, renderer: {}, onerparenting: function () {sap. M. Customtail.prototype.onereferringcol (this);}}); Var container 1 = new sap.m.TileContainer ({width: "100%", // sap.ui.core.CSSSize height: "100%", // sap.ui.core.CSS Size tiles: [New SAP M.Castile ({content: new sap.m. button ({text: "custom tile 1"})}, New Execution Control. MySpecialTile (), New sap.m.CustomTile ({content: new sap. M button ({text: "custom tile 3"}}})))],}); New sap.m.App ({pages: new sap.m. page ({enableScrolling: incorrect, title: "tile container", content: [container 1]})}). Place ("content"); & Lt; / Script & gt; & Lt; Body id = "content" & gt; & Lt; / Body & gt;  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -