我有一个 sap.ui.layout.ResponsiveSplitter ,如下所示:
目标是,当我按下 Jump 按钮时,它应该跳到第二个分割窗格:
视图是:
<mvc:View controllerName="sap.ui.layout.sample.ResponsiveSplitter.C" xmlns:l="sap.ui.layout" xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core" xmlns:m="sap.m" height="100%">
<l:ResponsiveSplitter defaultPane="Detail">
<l:PaneContainer>
<l:SplitPane requiredParentWidth="500" id="Selection">
<m:Panel height="100%">
<m:Label text="Selection"/>
<m:Button text="Jump" press="onPress"/>
</m:Panel>
<l:layoutData>
<l:SplitterLayoutData size="20%"/>
</l:layoutData>
</l:SplitPane>
<l:SplitPane requiredParentWidth="500" id="Detail">
<m:Panel height="100%">
<m:Label text="Detail"/>
</m:Panel>
</l:SplitPane>
</l:PaneContainer>
</l:ResponsiveSplitter>
</mvc:View>
和JavaScript代码:
sap.ui.define([
'jquery.sap.global',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function(jQuery, Controller, JSONModel) {
"use strict";
var ResponsiveSplitterController = Controller.extend("sap.ui.layout.sample.ResponsiveSplitter.C", {
onInit : function () {
},
onPress: function() {
}
});
return ResponsiveSplitterController;
});
我如何得到它?
答案 0 :(得分:0)
没有公开的方法可以执行您想要的操作。
但是,ResponsiveSplitter控件中有一个私有方法:
/**
* Sets the indexed page to visible and changes the selected button in the paginator
* @param {int} iPageIndex
* @private
*/
ResponsiveSplitter.prototype._activatePage = function (iPageIndex) {
var $PaginatorButtons = this.$().find(".sapUiResponsiveSplitterPaginatorButton"),
$OldSelectedButton = this.$().find(".sapUiResponsiveSplitterPaginatorSelectedButton"),
iOldActivePage = $PaginatorButtons.index($OldSelectedButton),
aPages = this.getAggregation("_pages") || [];
aPages[iOldActivePage] && aPages[iOldActivePage].setVisible(false);
aPages[iPageIndex] && aPages[iPageIndex].setVisible(true);
$OldSelectedButton.removeClass("sapUiResponsiveSplitterPaginatorSelectedButton");
$PaginatorButtons.eq(iPageIndex).addClass("sapUiResponsiveSplitterPaginatorSelectedButton");
$OldSelectedButton.attr("aria-checked", false);
$PaginatorButtons.eq(iPageIndex).attr("aria-checked", true);
};
通常,我们不应该调用内部方法,因为不能保证它们在整个框架版本中都保持一致。