更新完成后触发函数
Trigger function after update complete
当更新功能与 xsodata 一起使用时,我如何执行功能顺序?!到目前为止,我的问题是更新树 table 然后打开更新前打开的前几行。我正在使用 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)
}
有人有什么建议吗?
我通过 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)
}
});
还对 table 刷新进行了破解,因为有时渲染 table 会出现问题,我在这里问了这个问题:
当更新功能与 xsodata 一起使用时,我如何执行功能顺序?!到目前为止,我的问题是更新树 table 然后打开更新前打开的前几行。我正在使用 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)
}
有人有什么建议吗?
我通过 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)
}
});
还对 table 刷新进行了破解,因为有时渲染 table 会出现问题,我在这里问了这个问题: