最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - LightSwitch HTML Client to automatically run queries without refreshing entire page - Stack Overflow

programmeradmin1浏览0评论

In Lightswitch HTML client we have created a screen to display the work in progress for a particular business processes.

This is to be displayed on a big screen, much like when you go to Argos to collect your order. Here's a screenshot...

We are using some java script to refresh the page every 30 seconds.

setTimeout(function () {
    window.location.reload(1);
}, 30000);

However, there are two issues with this.

  1. The 'maximum number of results' text input by the user is lost on refresh.
  2. It doesnt look nice to refresh the whole page.

Is it therefore possible to just trigger each query to reload instead of the entire page?

(The data is provided to LightSwitch by a WCF RIA Service)

In Lightswitch HTML client we have created a screen to display the work in progress for a particular business processes.

This is to be displayed on a big screen, much like when you go to Argos to collect your order. Here's a screenshot...

We are using some java script to refresh the page every 30 seconds.

setTimeout(function () {
    window.location.reload(1);
}, 30000);

However, there are two issues with this.

  1. The 'maximum number of results' text input by the user is lost on refresh.
  2. It doesnt look nice to refresh the whole page.

Is it therefore possible to just trigger each query to reload instead of the entire page?

(The data is provided to LightSwitch by a WCF RIA Service)

Share Improve this question asked Apr 17, 2013 at 7:03 SkeetJonSkeetJon 1,4911 gold badge21 silver badges41 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

In the JavaScript, use screen.MyList.load(). It will reload the list asynchronously.

Note that IntelliSense does not always suggest list names on the screen object but will recognize them if you type the name.

Combined with the setTimeout() method and the created screen event, it should work.

I had the same issue and finally found the solution. I added this in my created event:

myapp.BrowseMembers.created = function (screen) {
    setInterval(function () {screen.Members.load(true);}, 1000);
};

Ii works, just the screen get flickering when reloading the data. setTimeout will only trigger once but setInterval will trigger every 1 second.

I had the same problem with LightSwitch VS2012 Update 3, for my case just invalidation is enough, so i can always work with a fresh entity. This code runs once on entry screen and invalidates loaded entities every 30 seconds, and forces a refetch just when needed.

myapp.aaHome.created = function (screen) {
    setInterval(function () { 
        screen.details.dataWorkspace.ApplicationData.Currencies._loadedEntities = {};
    }, 30000);
};

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论