当更新功能与xsodata一起使用时,如何执行功能顺序?!到目前为止,我的问题是更新树表,然后打开之前在更新之前打开的行。我正在使用setTimeout函数,但我知道它实际上不是这个问题的答案。
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)
}
有什么建议吗?!
谢谢大家的帮助!
答案 0 :(得分:0)
我设法通过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)
}
});
也为表刷新做了一个黑客,因为有时渲染表有问题,我在这里问这个问题:Bug after update TreeTable