Hi all,
i am extending an SAPUI5 control i am facing problem like creating dom elements multiple times,
the following code i am using.
sap.ui.commons.TextField.extend("HighlightField", {
metadata: {
properties : {name:{type:"string",defaultValue : "testingdefault"}
}
},
setName : function (ovalue){
this.setProperty("name",ovalue);
},
renderer: function(oRm, oControl){
//
sap.ui.commons.TextFieldRenderer.render(oRm,oControl); // any problem with this
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.addStyle("display", "block");
oRm.writeStyles();
oRm.write(">");
oRm.write("<div id='testdiv'");
oRm.addStyle("display", "block");
oRm.writeStyles();
oRm.addClass("myClass");
oRm.writeClasses();
oRm.write(">Title : "+oControl.getName());
oRm.write("</div>");
oRm.write("</div>");
}
});
i am using this control by creating object and in other control even(like button click)
i am trying like follows,
onClick: function(evt){
obj.setName(Math.random()); // here i am getting object through parents this.getParent().getContent()[0]
obj.setValue(Math.random());
}
in this case of value its working fine , but in case of Name it's creating multiple names and appending(based on number of setName()'s)
Thanks & reagrds,
Kotesh Adabala