cancel
Showing results for 
Search instead for 
Did you mean: 

Change default Expand/Collapse Icon in sap.m.Panel

Former Member
0 Kudos

Hi there,

I'm trying to build up a panel with a custom Expand/Collapse Icon. The panel is used to add New "instruments" so I'd like to have as icon the sap-icon add.

I've been looking arround for a solution but I only found how to do so using sap.ui.commons.panel as it has a method called addButton...

Thanks in advance,

Alex.

PD: Here you have an image to clarify what I'm talking about.


Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Hi Alex

I think the best way is to extend the sap.m.Panel like this

Example

-D

former_member182372
Active Contributor
0 Kudos

lovely!

Former Member
0 Kudos

Thanks!

Answers (3)

Answers (3)

former_member182372
Active Contributor
0 Kudos

//SearchPanel - sap.m.Panel

jQuery.sap.require("sap.ui.core.IconPool");

this.byId("SearchPanel").oIconCollapsed.destroy();

var sCollapsedIconURI = sap.ui.core.IconPool.getIconURI("search");

var thatPanel = this.byId("SearchPanel");

var oIconCollapsed = sap.ui.core.IconPool.createControlByURI({

   id : thatPanel.getId() + "-CollapsedImg",

   src : sCollapsedIconURI
}).addStyleClass("sapMPanelExpandableIcon").attachPress(function(oEvent) {

   thatPanel.setExpanded(!thatPanel.getExpanded());

});

oIconCollapsed.setDecorative(false);

this.byId("SearchPanel").oIconCollapsed = oIconCollapsed;

kai2015
Contributor
0 Kudos

For customizing:

Here is a example on how to customize a Panel:

You need to get the original Code, locate the prototype methods, where the icon is defined and redefine those methods in your custom Panel.

(Also you need to customize PanelRenderer)

kai2015
Contributor
0 Kudos

I would create for that a toolbar with an popup dialog or a new view for the creating form.