PDA

View Full Version : It's not too late to fix the cWebTreeView



Ianv
16-Feb-2016, 10:33 PM
Since 2013 there have been a number of issues reported with the cWebTreeView. This post applies to 18.2 http://support.dataaccess.com/Forums/showthread.php?57671-cWebTreeView-server-handler&highlight=cWebTreeView and Sture reported the same problem in May 2015.

I'm now running into the same issue with a cWebTreeView in a WebModalDialog. Clicking on a node returns the data I want and closes the dialog. If the dialog is opened again even after moving around views and despite a Fullrefresh in OnShow, the last item clicked is highlighted. If that item is clicked again, the OnSelect event is not called on the server and a second click is required. The client is clearly responding as shown in the attached images. The first click removes the icon alongside the item but doesn't tell the server. This looks to me like a bug in the .js It is true that if a different node is clicked that will respond immediately, as expected.

While this is not a deal breaker, it is something we are sharing with the user who has to work out that sometimes a double click is necessary. Not really a good look.

Ian

Harm Wibier
17-Feb-2016, 05:13 AM
There are a few things here.

First of all this pointed to a bug in the Df_Flat_... theme causing the icon to disappear when clicking the selected item again. That is a pure CSS change with a very low risk and this is introduced in 18.1 / 18.2 so that is something we will consider fixing that for 18.2.

Then there is the OnSelect behavior. The OnSelect is designed to trigger when the selected item changes by user interaction. According to that specification it is actually triggering too often as it sometimes triggers when clicking the selected item. Analyzing the code learns that that actually seems to happen pretty much by accident. Fixing this would make it function according to the spec but most like won’t help you (it also wouldn’t meet the requirements for something to be fixed in this stage of 18.2).

It seems that what you need an OnItemClick event that is triggered on every click. So that is a feature request for which certainly is too late in the 18.2 cycle.

What I don’t understand here is why the item is selected when you open the dialog for a second time. By default (certainly in 18.2) the treeview won’t have a selected item. Do you have code that selects the item or are you setting pbOverrideStateOnShow on the dialog?

Ianv
18-Feb-2016, 01:33 AM
There are a few things here.

First of all this pointed to a bug in the Df_Flat_... theme causing the icon to disappear when clicking the selected item again. That is a pure CSS change with a very low risk and this is introduced in 18.1 / 18.2 so that is something we will consider fixing that for 18.2.

Thanks Harm.


Then there is the OnSelect behavior. The OnSelect is designed to trigger when the selected item changes by user interaction. According to that specification it is actually triggering too often as it sometimes triggers when clicking the selected item. Analyzing the code learns that that actually seems to happen pretty much by accident. Fixing this would make it function according to the spec but most like won’t help you (it also wouldn’t meet the requirements for something to be fixed in this stage of 18.2).


You're right, as long as the selected item isn't being cleared the current behavior is better than the spec.



It seems that what you need an OnItemClick event that is triggered on every click. So that is a feature request for which certainly is too late in the 18.2 cycle.

I suppose that would overcome this problem but it would be better to fix the actual problem which I am sure is not to spec.


What I don’t understand here is why the item is selected when you open the dialog for a second time. By default (certainly in 18.2) the treeview won’t have a selected item. Do you have code that selects the item or are you setting pbOverrideStateOnShow on the dialog?

Nor do I understand why it comes up selected. It is almost as though the dialog is setting there in the background and is simply re-focused when opened a second time. I had pbOverrideStateOnShow set to false but setting it to true makes no difference. I was exiting the dialog by sending OK. I have now tried setting pbServerOnEscape to True and sending Cancel but no difference.

I'll do a bit more testing.

Ian

Harm Wibier
18-Feb-2016, 02:52 AM
Can you post a sample demonstrating your issue?

Ianv
18-Feb-2016, 08:19 PM
Hi Harm,
Issue resolved and the solution was in the Help (sort of).

I noticed during testing that FullRefresh was not being called after the initial call to the dialog. The data was all there and simply redisplayed from the cached html as explained below. Although the Help was concerned about security, simply placing the line:


Send UnloadView hoModalDialog

as the last line in OnCloseModalDialog causes the FullRefresh to fire each time and there is no selected item. I suggest in a future version DAW should add a WebProperty "pbUnloadDialogAfterSelection" which defaults to True. In the meantime, it might be worthwhile to amend the Help to advise developers to add the line above unless they have a good reason not to.


Unloading Dialogs for Security
When a modal dialog is loaded and displayed on the client, a cached copy of the dialog (including sub objects and web property values) will remain even after the modal dialog has been closed. Normally, this does not present a security problem as the logged in user should already have access rights to the dialog in order to load it in the first place.

A potential security consideration occurs if, after a dialog has been loaded, the current user logs out and a new user, with different access rights, logs in. The safest approach here is to ensure that the entire web application is reloaded whenever a new user tries to log in. This will ensure that all cached data is removed from the client.

Send NavigateRefresh (http://support.dataaccess.com/Forums/cWebApp-Procedure-NavigateRefresh.htm) to the global cWebApp (http://support.dataaccess.com/Forums/cWebApp.htm) object (ghoWebApp) to reload the entire web application.

Sometimes you may wish to retain the web application's current state, but remove specific views or dialogs from the client. Send UnloadView (http://support.dataaccess.com/Forums/cWebApp-Procedure-UnloadView.htm) to remove a specific view
or dialog from the client.


Ian