In XPages Mobile App, can you clear viewScope variables between page changes? - xpages

I'm working on an XPages Mobile app using mobile controls from Extension Library.
My hope page is a menu leading to 4 different mobilePages.
I get this this is 1 XPage and we're dealing with "Virtual Pages". But is there a way to clear viewScope variables and document bindings as you go back and forth between virtual pages?
For instance. In one of my pages I ask the user for some data. 3 Fields stored in viewScope Variables. Using that I then have a button to Create a new document which gets bound to a panel and then I do things with it.
If the user hits "back" from the menu bar, to go to the Home screen and then goes back to the same page I want to clear everything and start all over.
setting resetContent= true doesn't do anything here.
My virtual page is a custom control and I tried to clear everything on beforePageLoad but that wiped it all during a manual refresh.
I tried hooking into the rendered property of the back button but that fired during a full page refresh. Possibly I could live with partial refreshes but someone might still manually refresh it.
Any way to get this ability inside the single page app mobile context?
Thanks!

See the following XSnippet on OpenNTF.org for your answer and a worked example - have fun! BTW: this is something we want to support on the Mobile App Page in an upcoming release - for now you can use the worked example I provide on XSnippets!
http://openntf.org/XSnippets.nsf/snippet.xsp?id=calling-server-side-jscode-during-mobile-page-transitions

Have you tried using requestScope for the virtual page bindings? From your description, it sounds like this would be the correct scope to use.

Related

xpages partial refresh can't save after replicate local replica

Scenario:
User preview xpage for editing in web browser.
Developer replicate a local replica to the server.
User click save button and trigger save action partial/full refresh
In 8.5.2 crash the whole database based on can't find java design classes. In 8.5.3 no error CS/SS accrued but there are no changes applied to the document. Seems like if you replicate the sessionID is overridden. Is there a way to fix/detect it?
Any ideas?
thx
It relates to this effect: Meaning of java.lang.ClassCastException: someClass incompatible with someClass.
Simply said, every design change resets XSP engine. Since 8.5.3 you can control it by property "Refresh entire application when design changes" in XPage properties - turning it off (default since that version) will just "soft reset" XSP engine.
Anyway, you may loose some scoped variables and beans. This concludes to some rules to obey:
Do not allow developers to change design in production during working hours.
Notify users about the problem (onError event for partial refresh) - Tim's comment explains, that you won't get an error from partial refresh after design change, unfortunately. Simple CSJS code pinging app availability and report problem when app does not respond could work, but I don't advise that: we use "keep alive" control from ExtLib, and troubleshooting in domlog.nsf became a nightmare - it is full of pings (almost all the time - many users keep their browsers open overnight).
If data are very important, implement auto save mechanism similar to Google apps.
BTW: This effect is similar to time-outed session - partial refreshes will fail and user need to reload the page (and possibly loose edits).

Master View in Iphone

I had asp.net back ground and now developing apps for Iphone. I have been wondering is there some thing master view or theme for app as we had master pages for website designing in asp dotnet which make the whole website design generic
thanks
No you really don't have anything similar. You do get two great application templates, the Tab based view or the Navigation based. In the navigation controller certain things follow each view like the style of the navigation bar but that is it.
If you want to use something like PhoneGap and drop that into XCode then use a web based UI framework like jqTouch, then you can have a template :) but that is a completely different application model.
Master View? I'm not sure what you mean by this. You have a Window (UIWindow) that you add Views to (UIView). You only have one window, but are free to have as many Views as you like.
So it depends what you want to add, for example i have a banner that i want at the tope of evert screen. I added the ImageView to the window and scaled the Views so they left the top of the window showing.
If you wanted to add some default behaviour to your Views and or add an image view to every view. You could simply subclass UIViewController and go from there?
If you give a touch more detail about what you want to achieve I'll gladly go into more detail.

Best practice in building outlook layout in asp.NET & telerik radpanelbar as a page arch?

I am working on enterprise apps, I am using telerik controls to make life easier ;)
The layout of my application on the left radpanelbar used for the navigation menu, on the right side is the content.
I want to make this navigation menu to navigate to a usercontrol (.ascx file) instead of a page (.aspx file)
The navigation control is in the master page.
I have multiple reasons to make this kind of navigation:
I have many user controls, and do not want to make pages (.aspx) as many user controls as I have.
Which is the most important I want to make this happen on the fly with out post pack (AJAX).
So please could any one tell about the best practice to do it.
One possible solution might be to load the navigation user control programmatically via AJAX when the user clicks a panelbar item. Still positioning this user control on the master page and loading it from the content page is quite odd to me and I personally do not approve it as a good architectural decision.

Hiding a custom web part in SharePoint

I'm attempting to completely hide a custom web part I'm writing under specific circumstances. What I'm not finding a lot of help on is actually hiding the complete web part. Using:
this.Hide = true;
will hide the content of the web part, but it appears to leave the Chrome behind. I can't change the Chrome display, so that's not an option right now. Is there a more complete way to hide the complete web part using C#?
I'm not worried about the web part being rendered or not, just having it not visually display. What I ended up doing is changing the chrome through code if my specific situation arises.
this.ChromeType = PartChromeType.None;
this.Hidden = true;
The only way to ensure nothing is rendered to the page is to close the web part. From MSDN:
A WebPart control that is hidden
remains in its zone, is actually
rendered on its page, and participates
in page life cycle phases such as the
PreRender phase, even though it is not
visible in a browser. This is
different from WebPart controls that
are closed, because closed controls
are not even rendered on a page...
Use the SPLimitedWebPartManager and its CloseWebPart method to do this. (Be careful about disposing of SPLimitedWebPartManager as well as its Web property correctly.)
Alternatively, use a CSS or jQuery approach. The web part will still be rendered but you will be able to hide it as you originally wanted.

Sharepoint Web Part Page Problem (impossible to modify shared web part)

So I created this web part page on sharepoint, but everytime when I add a web part, the entire view gets squished into a narrow window. This makes it impossible to "modify shared web part" because all you can see on the menu pane are OK, Cancel and Apply. You can't fill in any detail or change anything from appearance to layout because you can't really see these options and put your mouse on them.
Thanks in advance for any help
I'm not sure if you want help with determine why this happens, or if you just want to get rid of the faulting web part?
If the latter, you can access the web part admin page by adding ?contents=1 to the URL to remove the web part in question.
This method is documented documented here.
http://<yourserverpath>/yourpage.aspx?contents=1
HTTP:\\MySPRootSite/pages/default.aspx?ToolPaneView=2
This will help u to forcibly display the page in edit mode.
I am struck with forcibly editing a web part in the page after the page is displayed in edit mode.

Resources