Skip to content Skip to sidebar Skip to footer

Setting Viewscope Onload And Onresize

I have used the '@media only screen' in my CSS to determine how and what information should be shown depending on the users screen size. I have a class called panelContainer which

Solution 1:

Ok can you check (or tell me if you already have) through some console.log("") 's that the onResize is being called and the correct display is being pulled down etc.

next it may be firing the onResize but are you then partail refreshing the area which is using the viewScope?

Code example of this: (replace controlID with yours)

XSP.partialRefreshGet("controlID", {
    onError: function() { console.log('Error'); }
});

I'm a little confused about what the purpose of using onResize is for ? if is to decide what to show whether on mobile or normal screen there are much more efficient ways of doing this.

  1. Using the new redirect control in the latest release of the ExtLib on openNTF. It does exactly what the name suggests and redirects based on certain expressions. leaving you to drop it on a page and say if mobile (or whatever) redirect to this page.

  2. Having a dummy default load page that checks the useragent string to see which page to load (having a separate mobile / fullscreen pages). This is what the teamroom template application that comes with the ExtLib does with its main.xsp and then this is set as the default launch option.

Or if you are trying to do something with whether the phone / tablet is on landscape or portrait you should be using the onOrientationChange event not onResize. check out this example (not the code in the question is what I'm pointing you too, he has a problem getting that to work in a webview):

how to handle javascript onorientationchange event inside uiwebview

Post a Comment for "Setting Viewscope Onload And Onresize"