Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
By-passing $dirty check
Message
 
 
À
01/04/2015 09:58:53
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01609780
Message ID:
01617617
Vues:
15
>>My problem is quite complex in that form. If I make a change in a page, then immediately try to switch to a different row from the parent form or go to another menu, I get a question about changes, so that's good. But if I make a change, switch to another tab in that form, then return to the same tab and try to go to another menu, I don't get the question and the dirty state of the form is lost.
>
>>So, this is one problem with the technique we're using of switching tabs.
>
>IIRC your tabs are replacing the view below them so the problem maybe that the view is being reloaded when you switch tabs. Did you try my suggestion to put named views *as tab content* ?
>

I tried that, but with these changes I could not get the views to show at all. I gave up and had to revert to the original technique.


>>
>>However, it gets even more weird. If from the invoices list tab I go inside the invoice edit form, try to change search text (which has noDirtyCheck directive) on the Transactions page, then try to go to another tab within that invoice edit form, I get a prompt. I can answer that I don't care about changes, switch again, then back to transactions, then back to another tab and I again get the same prompt. In other words, in this particular case the dirty state remains and the form should not have been made dirty in the first place because I have this directive.
>
>Bear in mind that simply setting an inputs $dirty to false (even when there are no other dirty controls) will not cause the form $dirty to be re-evaluated. You may need something like this in your directive after $setPristine():
var dirty = false;
>angular.forEach(scope.theForm, function (value, key) {
>    if (key[0] != '$') {
>        if (value.$dirty) {
>                dirty = true;
>        }
>    }
>});
>if (!dirty) {
>scope.theForm.$setPristine();
>}
This will reset the form if all inputs are pristine.....
>
>>So, that are my problems with that particular complex form. Yesterday I thought I'll try to fix the problem with Transactions page quickly and switch to a different task (calling C# static method from VFP). Instead I spent several hours in that form with 0 success. This is quite frustrating.... :(

Thanks again, Viv.

I am now going to apply your suggestions and see if at least one problem will be solved.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform