PDA

View Full Version : Catch when user is moving away from the displayed Grid



vivek.damco
30 Nov 2010, 6:26 AM
Hi

I am facing an issue for which I tried searching at forums but could not locate anything related to it.

The problem is as following:

My project is having two sections - left and right. In the left section, I have links to navigate through the project. Clicking at these links, a user can change the content of right section.

In the right section the content is displayed under tabs. These tab-panels generally contain Editor Grids where the user can edit the data and a Save button at which the user can click to save the edited data.

Now, the issue is, that if a user clicks somewhere outside the grid without saving the edited data then I need to present him a confirmation box "Do you want to save the changes made?". But, unfortunately, I am not being able to locate any such property of the grid with which I can check that if a user has clicked "outside grid" and is about to move away from the grid.

I have tried using events like - 'deactivate', 'beforecollapse', 'beforedestroy' - for editor grid but no luck.

Any help would be really appreciated.

Thanks

VDam

Condor
30 Nov 2010, 7:20 AM
I would recommend using the beforetabchange event for this (and after showing the confirmation dialog, return false to stop the tab from changing).

vivek.damco
30 Nov 2010, 8:48 PM
Hi Condor

Many Thanks for your reply.

I am sure that this can resolve the issue related to when a user is trying to change the tab within the right section.

But I was wondering if there was any solution for catching the click at the links in the left section which leads to the complete reloading of the right section and thus leading the loss of focus from the current grid.

Is there any property which defines the "space" of grid or panel or any container using which we can catch if the user has clicked in that "space"?

Thanks again

VDam

Condor
1 Dec 2010, 6:23 AM
You can use a click event handler on the document itself and check if the target is inside the tab.

There are some problems with this however:
1. Some components stop click events (e.g. the tabpanel strip).
2. Some components render additional elements to the document (e.g. combobox list).

vivek.damco
3 Dec 2010, 1:36 AM
Hi Condor

Many thanks for your help. It would surely help us in progressing a step further.

Thanks again

VDam