更新完成后触发功能 [英] Trigger function after update complete

查看:86
本文介绍了更新完成后触发功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当更新功能与xsodata一起使用时,如何执行功能订购?到目前为止,我的问题是更新树表,然后打开在更新之前已打开的先前行.我正在使用setTimeout函数,但我知道这实际上不是解决此问题的方法.

How can I perform the functions order, when the update function works with xsodata?! So far my problem is with updating the tree table and then open the previous rows that has been opened before update. I am using the setTimeout function but i know it is actually not the answer to this problem.

tEvents.unbindAggregation("rows");
tEvents.bindAggregation("rows",{
    path: "events>/prg_years(ID_SCENARIO=" + filterKRVR.scenario + ",I_YEAR=" + filterKRVR.year + "m)" + "/HisGTO",
    parameters: {
        navigation: {
            'prg_gto':  "HisPIPE",
            'prg_pipe': "HisKS",
            'prg_ks':   "HisLK"
        },
    }
}); 

tEvents.getModel('events').refresh();



if(bookmark.gto!==null){
    var that = this;
    setTimeout(function(){
        var t = that.getView().byId('eventsKRVR');
        t.expand(bookmark.gto);
    },800)
}
if(bookmark.pipe!==null){
    var that = this;
    setTimeout(function(){
        var t = that.getView().byId('eventsKRVR');
        t.expand(bookmark.pipe);
    },1500)
}
if(bookmark.ks!==null){
    var that = this;
    setTimeout(function(){
        var t = that.getView().byId('eventsKRVR');
        t.expand(bookmark.ks);
    },2500)
}

有什么建议吗?!

谢谢大家的帮助!

推荐答案

我设法通过attachRequestCompleted解决了这个问题.

i managed to solve this question by attachRequestCompleted.

tEvents.getModel('events').attachRequestCompleted(function (oEvent) {
                    var url = oEvent.mParameters.url;
                    if(url.indexOf('prg_years') >= 0){
                        setTimeout(function(){
                            that.doRefresh();
                            setTimeout(function(){
                                tEvents.expand(bookmark.gto);
                            },100)
                        },100)
                    }else if(url.indexOf('prg_gto') >= 0){
                        setTimeout(function(){
                            that.doRefresh();
                            setTimeout(function(){
                                tEvents.expand(bookmark.pipe);
                            },100)
                        },100)
                    }else if(url.indexOf('prg_pipe') >= 0){
                        setTimeout(function(){
                            that.doRefresh();
                            setTimeout(function(){
                                tEvents.expand(bookmark.ks);
                            },100)
                        },100)
                    }else if(url.indexOf('prg_ks') >= 0){
                        setTimeout(function(){
                            that.doRefresh();
                            setTimeout(function(){
                                $('.sapUiScrollBar div').scrollTop(32*bookmark.lk-64);
                            },100)
                        },1000)
                    }
                });

还对表刷新进行了破解,因为有时呈现表存在问题,我在这里提出了以下问题:

also made a hack for table refresh, because sometimes there is a problem with rendering the tables, i asked this question here: Bug after update TreeTable

这篇关于更新完成后触发功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆