在“外部”创建的OData成功函数中,回调函数“内部”的忙碌对话有多接近?

时间:2016-07-18 16:51:12

标签: sapui5

在创建OData创建实体之前,我显示一个忙着的对话框控件,显示“正在处理...”。 我想根据情况关闭成功或错误回调函数内部的繁忙对话框,但我无法访问繁忙的对话框对象...有人可以帮助我吗?

代码:

String record = '''
    <u:record>
        <u:controlfield tag="001">017003167</u:controlfield>
        <u:datafield ind2="" ind1="" tag="Tag_1234">
            <u:subfield code="a">Peter</u:subfield>
            <u:subfield code="b">10</u:subfield>
        </u:datafield>  
        <u:datafield ind2="" ind1="" tag="Tag_1234">
            <u:subfield code="a">Simon</u:subfield>
            <u:subfield code="b">20</u:subfield>
        </u:datafield>  
        <u:datafield ind2="" ind1="" tag="Tag_20">
            <u:subfield code="a">Simon</u:subfield>
            <u:subfield code="b">20</u:subfield>
        </u:datafield>          
    </u:record>
    '''

GPathResult studentRecord = new XmlSlurper(false, false).parseText(record)
GPathResult filteredRecord = studentRecord.datafield.findAll { it.'@tag' == 'Tag_1234' } 

println "filteredRecord: ${filteredRecord}\n"
println "filteredRecord size is ${filteredRecord.size()}\n"

谢谢!

1 个答案:

答案 0 :(得分:1)

您将成功功能绑定到,这样您就可以将繁忙的对话框实例存储为某个属性,并且它将在您的成功函数中可用。像这样:

//Create Busy Dialog
this._oBusyDialog = new sap.m.BusyDialog({
    ...
    }
});

//Trigger a POST request to the odata service...
this.getView().getModel.create('/MyEntitySet', myEntityObject, {
    success: function(){
                 if (this._oBusyDialog) {
                   this._oBusyDialog.close();
                 }
                 (...)
             }.bind(this),
    (...)
});