Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

is it possible to add an event to SAPUI5 sap.ui.commons.Panel's minimize and maximize? What i need is to add a different style when the Panel's collapse- or expand-Button is clicked.

If the user clicks on the minus-Symbol i have to add a styleclass like pnl.addStyleClass("XYZ"); when the user clicks on "maximize" a different styleclass should be added to the panel pnl.addStyleClass("ZYFDEFD");

if i overwrite the .setCollapse- or .setExpanded-function the panel doesn't collapse or expand anymore, so something else has to be found.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
244 views
Welcome To Ask or Share your Answers For Others

1 Answer

A couple of possible options...

1) You could make use the standard style class (sapUiPanelColl) which is added to the control depending on the expanded state - see example below...

var oPanel = new sap.ui.commons.Panel({});
oPanel.addStyleClass("myPanel");
oPanel.placeAt("content");
.myPanel { background-color: green; }
.myPanel.sapUiPanelColl { background-color: red; }
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>sap.ui.commons.Panel style class example</title>
</head>
<body id="content">
<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,sap.ui.commons"></script>

</body>
</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...