Best method for detecting input changes with QDataWidgetMapper - qt4.8

I'm using QDataWidgetMapper for editing data-base.
Does QDataWidgetMapper or any class (parent/mapped widgets/etc.) emit a signal, when any user-data in mapped widgets changes? At least, is it possible to check the changes by a method call manually?
I want the user to approve changes before submit and to display an icon on the form if something has changed.
It appears to me to be a very basic feature, but I can't find it.
Should I really connect each mapped widget and check the changes for each widget individually?

you can put the submit strategy of your mapper to manual submit, add a save button to the gui, after user clicks save you can ask for verification. if ok call mapper submit.

Related

How to destroy a component on navigation

I need to destroy a component on navigating away from it but I cannot figure out how to do it. I've tried clearHistory: true in RouterExtensions, but it doesn't work. The flow of our program is this:
Dashboard > link to Component1
Component1 > Save takes the user back to Dashboard.
If the user clicks the link to go back to Component1, I get an ExpressionChangedAfterItHasBeenCheckedError because the memory of the component is still resident.
It is bit tricky to remove a page from the navigation history in nativescrupt angular. I would suggest you to create a modal page for Component1, save it and when user close the modal, take it back to Dashboard.
or you need to handle the change detection manually, for further reading, you can refer here.
I solved my immediate problem by redesigning the page to use calculated values based on the data rather than ui state settings from the ngrx store which, as I thought about it, is a more stable solution.
I left the question up because I was curious if there was a way to remove pages from the navigation history.

vaadin - delay execution while modal dialog window is open

I have a grid layout in which I want to show a pop up when the user tries to replace a component which is already present in the grid.
For e.g. the grid layout has a Label (wrapped in a DragAndDropWrapper) which is present at 0,0 position.
If the user tries to add a new component at the same position(0,0 position), then it should show a pop up (confirmation dialog box) asking the user to confirm if the user wishes the replace the existing component or not.
Now, my issue is that the current thread does not wait for the execution to complete. It keeps going ahead after showing the pop up box. Thus, there is a lot of problem in updating the UI after the input is taken from the dialog box for the user's answer.
Can someone show how to do this? Note that I need to do this in a DragAndDropHandler's drop method call as I need to show the dialog box only when the user tries to drop a new component on an existing component of the grid layout.
A working example would be a great help.
Thanks in advance.
So I followed the comment by André Schild and it did work for me.
I just remember which component and location was used for replacing the component. Then, I ask for a confirmation and if the user says Yes, then I just go ahead and replace it.
Thanks again Andre

How to disable the whole page?

I have a field where a customer number is required. When the user leaves the field in the onblur event I need to run some code, in this case check if the given number is already in use. The problem is the codes needs some time to complete. For this short period the user should not be able to make any input. Also I'd like to display a gif.
There is a genius snippet on XSnippets called "Standby Dialog" (https://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control)
If you implement this on your page (preferably as custom control) you will get an overlay everytime a partial refresh happens. If you init a partial refresh when the user blurs the field you will get what you want.

How do I create a messagebox to inform successful save in xpages?

I've set my button to 'Submit'. The XPage is set to stay on the same page if save is successful. How do I create a messagebox to inform user the save is successful?
There are a number of options you can consider. A msgbox is the least desirable.
You could add an information message on top of the form that either fades after a few seconds or on change. The custom control would show when you set a viewScope variable (e.g. viewScope.saveSuccess ) and have a visibility formula for it. It also would register an event listener to hide when a field is altered. You also could consider redirecting to a different page.
This post already asks a similar question to do with how to call a client side script from server side, could be useful.
client message after SSJS routine how?
Here are two examples that I have used as inspiration to create a custom control for error messages and for info messages such as what you are asking for:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=ssjs-form-validation-that-triggers-errormessage-controls
http://lotusnotus.com/lotusnotus_en.nsf/dx/xpages-tip-a-simple-cc-for-prompting-ssjs-messages-to-ui....htm
The easiest way to call csjs after running ssjs is to add code the event handler's onComplete event. The onStart, onComplete, and onError events run client side js before or after your ssjs, but are only executed during a partial page refresh.
The simplest way is to add this line of code (or the CSJS you prefer) in the postSaveDocument event:
view.postScript('alert("Document saved")');

Automatically submit/save InfoPath form to SharePoint

I'm designing an InfoPath form that will be saved to a SharePoint 2010 library. This will occur automatically when the user performs a certain action on the form. If the user closes the form, it should prompt them to save changes and if necessary, save to SharePoint.
Problem is I don't want the users to have control over where the form is saved or what it's called, as I intend to handle that automatically.
Now it's possible to capture the onSave event and perform a custom action. But if I did this, I'd need to set the property to cancel the save event, or the user will be shown the "save file" dialog box anyway. But cancelling the save event causes InfoPath to display a warning to the user - "InfoPath cannot save the form. The OnSaveRequest event handler returned a value indicating that the save failed".
Is there any way to facilitate custom save events while still allowing the user to use the save button? It's also important that the user is promted to save changes if they try to close the form, however disabling the save option removes that prompt.
I worked out what to do. The solution is much simpler than I thought.
Capture the onSave event, perform the custom save action, set the cancel flag to false, and remove the call to PerformSaveOperation(). This eliminates the mentioned error message, and doesn't prevent the user from closing the form.

Resources