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

How to set style/Class for parent DOM Element

$
0
0

Hi all,

I am using SAPUI5 1.12.1 version

 

In vertical layout I am adding one label
I want to set class to parent element of label (Not to vertical layout control. But to the div which content label. )
for eg:

var oLabel = new sap.ui.commons.Label({text:"Name:", labelFor: oText});

var oButton = new sap.ui.commons.Button({text:"Submit", tooltip:"Submit value"});

var oLayout = new sap.ui.commons.layout.VerticalLayout("Layout1", {

content: [oLabel, oButton]

});

 

 

 

will generate HTML as follows

<div class="sapUiVlt sapuiVlt" data-sap-ui="Layout1" id="Layout1">

   <div class="sapUiVltCell sapuiVltCell  MyCustomClass">

         <label class="sapUiLbl sapUiLblNowrap" style="text-align:left;" dir="Inherit" for="__field0" data-sap-ui="__label1" id="__label1">Name:</label>

   </div>
   <div class="sapUiVltCell sapuiVltCell">

         <button class="sapUiBtn sapUiBtnNorm sapUiBtnS sapUiBtnStd" tabindex="0" aria-disabled="false"

                 role="button" title="Submit value" data-sap-ui="__button2" id="__button2" type="button">Submit</button>

    </div>

</div>

 

I want to give style or class to parent Div("sapUiVltCell sapuiVltCell") of label element as "MyCustomClass" or want to add custom style as "background-color:#fefefe ;"

 

Also this vertical layout is always generated On click particular view. So how to set css to that auto-generated div on run time


Viewing all articles
Browse latest Browse all 6178

Trending Articles



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