Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

attachbrowserEvent with dynamic text field

$
0
0

Hello Experts,

 

My requirement is to highlight textfield in focus with a particular color. I have a set of textfields being generated dynamically. I have used attachBrowserEvent("focus") for the same, but somehow it works only for the 1st time. The same textfield when focused again doesnt get highlighted thought the event does get called. Highlighted the relevant code

 

The code is as below:

 

for(var j=0;j<weekData.length;j++)

{

var weekNo = weekData[j].weekNo;

var oTimeProjCell = "ProjCell1"+weekData[j].weekNo+projNum+month+year;

var oTimeProjLayoutCell1 = new sap.ui.commons.layout.MatrixLayoutCell(oTimeProjCell,

{

backgroundDesign : sap.ui.commons.layout.BackgroundDesign.Transparent,

colSpan : 1,

hAlign : sap.ui.commons.layout.HAlign.Center,

padding : sap.ui.commons.layout.Padding.Both

});

var oTimeEntries = new sap.ui.commons.TextField("Week"+weekData[j].weekNo+'oTimeEntries'+projNum+'year'+year,{

width : '50px',

height: '90px',

 

}).attachBrowserEvent(

"focus",function(evt) {

console.log(sap.ui.getCore().getElementById(evt.target.id));

  sap.ui.getCore().getElementById(evt.target.id).addStyleClass("timeEntryTextField");

 

console.log("Added");

}).attachBrowserEvent(

"blur",function(evt) {

sap.ui.getCore().getElementById(evt.target.id).addStyleClass("timeEntryBlur");

});




Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>