UI5 MessageBox保持透明

时间:2015-06-29 20:08:35

标签: sapui5

我有一个消息框,我想在一行上做一些额外的编辑。但是一旦我展示它,它仍然是透明的。是否有一些我错过的东西给它一个正常的背景。

表格的片段:                                                             

     <Label text="UnitPrice"/>
        <Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
        <Label text="Quantity"/>
        <Input type="Text" text="{path: 'Quantity' }"/>
    </form:SimpleForm>
</core:FragmentDefinition>

我如何调用片段。

handleLineItemPress : function (evt) {
    var context = evt.getSource().getBindingContext();
    var oLayout = sap.ui.xmlfragment("ApproveSESComponent.DO_SES.view.LinePopup", this);
    var oModelTemp = this.getView().getModel().getData();
    // get the view and add the layout as a dependent. Since the layout is being put
    // into an aggregation any possible binding will be 'forwarded' to the layout.
    var oView = this.getView();
    oView.addDependent(oLayout);

    var that = this;
    sap.m.MessageBox.show(oLayout, {
          icon: sap.m.MessageBox.Icon.INFORMATION,
          title: "My message box title",
          styleClass: "sapUiSizeCompact",
          actions: [sap.m.MessageBox.Action.YES, sap.m.MessageBox.Action.NO],
          onClose: function(oAction) { / * do something * / }
      });}

3 个答案:

答案 0 :(得分:0)

我改变了styleClass:&#34; sapUiSizeCompact&#34;以此为其他东西,然后为这种风格添加背景色。 然后盒子不再是透明的。

答案 1 :(得分:0)

我认为sap.m.MessageBox不是为简单的基于按钮的选择而设计的输入。当然,这就是我阅读documentation的方式(这就是消息框通常在其他API中的工作方式):

  

提供更简单的方法来创建类型为sap.m.DialogType.Message的sap.m.Dialog,例如标准警报,确认对话框或任意消息对话框。

你可以将它变成一个允许你添加一个输入字段但我不认为它是如何设计的(它看起来没有文件记录)并且如果它在未来的版本中中断,也不要感到惊讶。而是使用sap.m.Dialog。

答案 2 :(得分:0)

这里的问题......

解决方案:我在基于sap.ui.common元素的项目中使用了sap.m.MessageBox。用sap.ui.common.MessageBox替换它,我有一个很好用的消息框。