Fiori2.0学习笔记-dialog应用

dialog is means duihua in chinese.

sap.m.dialog also known as Pop-up components(弹出框组件).

For example, Loading Data,Comfirm,Warning…

Property
sap.m.BusyDialog : Wait
sap.m.Dialog:in common use and we can deal with something
sap.m.SelectDialog:make use of the drop-down box from the select component
sap.m.TableSelectDialog
sap.m.ViewSettingsDialog
sap.m.P13nDialog

Demo

<content>
    <Button text="showBusyDialog" press="showBusyDialog"></Button>
    <Button text="showSelectDialog" press="showSelectDialog"></Button>
</content>
    showBusyDialog: function(oEvent) {
            // instantiate dialog
            if (!this._dialog) {
                this._dialog = sap.ui.xmlfragment("richard.demo.dialogDialogDemoCase.view.BusyDialog", this);
                //Associated life cycle
                this.getView().addDependent(this._dialog);
            }

            // open dialog
            this._dialog.open();

            // simulate end of operation
            this._timeout = jQuery.sap.delayedCall(3000, this, function() {
                this._dialog.close();
            });

            //call dialog in view.
            // var oDialog = this.getView().byId("BusyDialog");
            // oDialog.open();

        onDialogClosed: function(oEvent) {
            jQuery.sap.clearDelayedCall(this._timeout);
            if (oEvent.getParameter("cancelPressed")) {
                MessageToast.show("The operation has been cancelled");
            } else {
                MessageToast.show("The operation has been completed");
            }
        }

If you want to get a simple loading ,you could to delect the property.

<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core">
    <BusyDialog
        title="Loading Data"
        text="... now loading the data from a far away server"
        showCancelButton="true"
        close="onDialogClosed"/>
</core:FragmentDefinition>

sap.m.SelectDialog

<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core">
    <SelectDialog
        class="sapUiSizeCompact"
        noDataText="No Products Found"
        title="Select Product"
        search="handleSearch"
        confirm="handleClose"
        items="{
            path: '/PurchaseOrderCollection'
        }" >
        <StandardListItem
        class="sapUiSizeCompact"
            title="{ID}"
            description="{Status}"
            iconDensityAware="false"
            iconInset="false"
            type="Active" />
    </SelectDialog>
</core:FragmentDefinition>
    showSelectDialog: function(oEvent) {
            if (!this._oDialog) {
                this._oDialog = sap.ui.xmlfragment("richard.demo.dialogDialogDemoCase.view.SelectDialog", this);
                this._oDialog.setModel(this.getView().getModel());
                this.getView().addDependent(this._dialog);
            }

            // Multi-select if required
            this._oDialog.setMultiSelect(false);

            // Remember selections if required
            this._oDialog.setRememberSelections(false);

            // clear the old search filter
            this._oDialog.getBinding("items").filter([]);
            //jQuery.sap.syncStyleClass("sapUiSizeCompact", this.getView(), this._oDialog);
            this._oDialog.open();
        }
    handleSearch: function(oEvent) {
            var sValue = oEvent.getParameter("value");
            var oFilter = new Filter("ID", sap.ui.model.FilterOperator.Contains, sValue);
            var oBinding = oEvent.getSource().getBinding("items");
            oBinding.filter([oFilter]);
        }
        handleClose: function(oEvent) {
            var aContexts = oEvent.getParameter("selectedContexts");
            //var aContexts = oEvent.getParameter("selectedItem");
            if (aContexts.length) {
                MessageToast.show("You have chosen " + aContexts.map(function(oContext) {
                    return oContext.getObject().ID;
                }).join(", "));
            }
            oEvent.getSource().getBinding("items").filter([]);
        }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值