0

我有一个要求,我在单击按钮时添加了面板。

在控制器功能中,我编写了如下代码。单击按钮时,我在控制台中没有收到错误,也没有收到面板。

但是,当我console.log看到面板对象时,我可以看到面板已创建,但不确定为什么没有反映在视图中。请提出建议。

onAddObjectiveClick: function () {
        var panel = new Panel({
            headerText: "Description",
            visible: true,
            backgroundDesign: "Solid",
            content: new TextArea({
                value: "Lorem Ipsum is simply dummy text of the printing and typesetting industry",
                growing: true,
                width: "100%",
                height: "263px"
            })              
        });

} this.getView().addDependent(panel);// 在这个地方我也尝试过setExapandedsetExpandible但没有任何帮助。

4

1 回答 1

1

您基本上是在创建一个对象,分配给一个局部变量而不是将其添加到您的视图中。

您应该有任何类型的带有聚合的容器元素来添加您的面板。

根据容器的不同,聚合名称会有所不同,因此您需要调用的方法才能将面板添加到其中。

示例:如果您需要content在类的聚合中添加此面板sap.m.Page,您应该

1) 拥有页面

2)在控制器内捕获它

3)调用addContent()

于 2019-11-07T20:48:24.377 回答