我的Lightswitch应用程序中有一个Back Button ,我需要直接链接到特定的屏幕。 链接的屏幕需要一个ProjectID值,我从您单击“ Back的页面提供该值。
问题是当我点击回来时,我被带到了正确的页面,但是在页面刷新之后才会显示任何记录。 我需要在加载完成后刷新页面
我一直在搞乱setTimeout和setInterval而没有运气。 这可以在我的按钮点击中完成,还是我应该完全使用不同的导航方法?
使用setTimeout代码(不向后导航):
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); showDetails = function () { setTimeout(function () { window.location.reload(true); }, 0) } window.location.reload(true); };导航回来但需要刷新以显示数据的代码:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail), function () { }//Need to execute reload AFTER show screen has completed };您可能会注意到我已经注释掉了widow.history.back(); ...这是在我的应用程序的第一次迭代中工作,但现在有两种不同的方法登陆页面,因此历史记录不可靠
I have a Back Button within my Lightswitch Application which I need to link directly to a specific screen. The linked screen requires a ProjectID value which I supply from the page which you are clicking Back on.
The problem is that when I click back, I am brought to the right page but no records display until after a page refresh. I need to refresh the page AFTER the load is complete
I have been messing with setTimeout and setInterval with no luck. Can this be done within my button click, or should I be using a different navigation method entirely?
Code with the setTimeout (doesn't navigate backward):
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); showDetails = function () { setTimeout(function () { window.location.reload(true); }, 0) } window.location.reload(true); };Code which navigates back but needs the refresh to show data:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail), function () { }//Need to execute reload AFTER show screen has completed };You may notice that I have commented out widow.history.back();... this was working in the first iteration of my application, but there are now two different ways to land on the page so History is unreliable
最满意答案
不知道我之前怎么没有得到这个..
BobbyJ的回应让我想到了commitChanges让我想到跳过javascript技巧,并使用我已经拥有的东西。
此代码有效:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail).then(function(){ myapp.commitChanges() }).then(function () { window.location.reload(true);//Need to execute reload AFTER show screen has completed }) };这就是我实际需要的所有内容:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail).then(function(){ window.location.reload(true); }) };只需使用.then()功能。 很俏皮
Not sure how I didn't get this before..
BobbyJ's response got me thinking about commitChanges which got me thinking about skipping javascript tricks, and using what I already had.
This code works:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { // window.history.back(); myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail).then(function(){ myapp.commitChanges() }).then(function () { window.location.reload(true);//Need to execute reload AFTER show screen has completed }) };This is all that I actually needed though:
myapp.ViewRecordDetails.BackButton_execute = function (screen) { myapp.showViewProjectDetails(screen.TBG_V_TimeLog_Detail).then(function(){ window.location.reload(true); }) };Just utilizing the .then() functionality. Pretty nifty
更多推荐
发布评论