Trigger function after update complete

不想你离开。 提交于 2019-12-12 06:37:26

问题


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)
}

any suggestions?!

thank you all for the help!


回答1:


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



来源:https://stackoverflow.com/questions/35198174/trigger-function-after-update-complete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!