Xpages same document in multiple windows

泄露秘密 提交于 2019-12-23 04:28:15

问题


In an XPage application we look after, users have long been complaining of "data loss" at random times when using it. By this they mean that when they submit the document they sometimes have the page refresh and all the fields they have just edited are blank, or in the state at the time of original page load and so they have experienced Data Loss. It has taken a lot of time to work out what is going on, with every action they perform now being logged in documents so I can review it. We found out what is happening and I need to work out a way around it:

  1. Open document in window 1 in Chrome / IE - browser not important.
  2. Open another window in browser and search for the same document in the app, open it (this opens it in read mode by default)
  3. Document has multiple tabs on it as there is a lot of information - user goes to the tab they want to copy information from on the read only copy in window 2
  4. User then starts typing information in to the editable version in window 1 - they want to reference part of the document that is on another tabbed panel, hence having it open in to windows.
  5. User submits their changes. Unfortunately, because they have opened the doc in another window, then clicked on one of the tabbed panels to open another part of it, the editable version effectively becomes dis-associated from the context in server memory (I assume) - the changes are lost on the submit and the user needs to re-enter.

If they open the read only version and don't navigate around the tabbed panels, they can continue working in the editable version just fine. It seems that the submission of the document, even when it's in read mode, breaks the link that the editable version has with the server. Why is this and how can it be prevented?

I would want to prevent them opening it in another window (not sure how though) as an absolute last resort - it's become a way of working for many users in many countries. Any ideas??

Some more info as requested: Ok so the documents are problem reports. Basic details about the caller, model affected and such on the first tab. There is an attachments tab, and among others, there is a solution tab.

When identifying what the user was doing, he basically said that because he couldn't remember the caller's name and wanted to address the solution to the caller, he opened the document in another window. Seems a bit lazy but anyway.

There was a post by a guy called John Mackay I think some time ago about keeping track of the tab that was selected with a sessionScope variable that I am using for a couple of reasons. The onclick event of the tabs therefore sets the sessionScope.tabSelected var to whatever is selected. This helps when I do a full update on the document, in that the tab the person was last on is the one that is selected by default after the refresh. So when the user opens the document in another window, the sessionscope var causes the same tab to open there too.

If the user is on the "Solution" tab and they open the doc in another window, the solution tab is also selected. They then have to select the "Information" tab to go and find the caller's name and it's this that causes the problem. Maybe a var with a lesser scope may fix it? I have tried "Do Not update or validate" and "Partial execution" settings with the onclick but that hasn't fixed it. I am going to try it without setting scoped vars on the tab clicks when I'm back in the office tomorrow to see if this fixes anything and will report back


回答1:


Solved! I had a tabbed panel and in the definition, I had :

selectedTab="#{javascript:sessionScope.TabSelected}"

On each of the tabs, I had an event handler that would set sessionScope.TabSelected. I tried Partial Execution Mode, I tried Do Not Validate or Update Data but nothing worked.

Then I removed the event handler completely on each tab and also the selectedTab property. Now you can open the document in edit in 1 window, and read in another, click tabs in the read version and it doesn't affect the document in the editable window. Submit the editable version and it's not rejected by the server which is exactly what I want.

The only downside is that if you perform a full update on the document now and the page reloads, it goes back to the first tab in the tabbed panel instead of where you were. I'm hoping this will be acceptable by the users!



来源:https://stackoverflow.com/questions/12198351/xpages-same-document-in-multiple-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!