Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mix of named and not named views
Message
De
26/03/2015 12:07:39
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01617276
Message ID:
01617287
Vues:
23
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>>>
>>>>>>> .state('edit.invoices', {
>>>>>>>                url: '/invoices:invoiceId?accountNameHash?isNew',
>>>>>>>                views: {
>>>>>>>                    'invoices': {
>>>>>>>                        templateUrl: '/CustomerAccounts/accounts/EditAccountInvoices',
>>>>>>>                        controller: 'invoicesSearchController'
>>>>>>>                    },
>>>>>>>                    'detail': {
>>>>>>>                        templateUrl: '/CustomerAccounts/invoices/editForm',
>>>>>>>                        controller: 'invoicesCrudController'
>>>>>>>                    }
>>>>>>>                }
>>>>>>>            })
>>>>>>>
>>>>>>>And the SelectView method is the following:
>>>>>>>
>>>>>>>
>>>>>>>$scope.selectView = function (viewName) {
>>>>>>>              if (viewName === 'invoices') {
>>>>>>>                  $scope.invoicesViewActivated = true;                  
>>>>>>>              }
>>>>>>>              else
>>>>>>>                  $scope.invoicesViewActivated = false;
>>>>>>>              
>>>>>>>              window.console && console.log('SelectView called with the ' + viewName + ' view...');
>>>>>>>
>>>>>>>              if ($scope.isNew) {
>>>>>>>                  $state.go('new.' + viewName);                  
>>>>>>>              }
>>>>>>>              else {
>>>>>>>                 $state.go('edit.' + viewName);                
>>>>>>>              }
>>>>>>>          };
>>>>>>>
>>>>>>>So, this is what is happening when I click on the Invoices tab: the invoices view is activated, but also the details view is activated and the general page of the edit invoices view. This is not what I want to be happening as I haven't clicked on the individual invoice in the grid yet. Also, the two other tabs (Apply Fees and Pay Invoices) share the same functionality and suppose to also be able to call the invoice edit form when clicking on the invoice.
>>>>>>>
>>>>>>>So, I am a bit confused as what should I do to avoid calling unnecessary code when not needed. I don't want to activate details view and related views till I actually click on the invoice.
>>>>>>>
>>>>>>>Please see attached and note the console messages as what is happening here.
>>>>>>>
>>>>>>>Thanks a lot in advance.
>>>>>>
>>>>>>Only a quick look but it seems to me that your selectView() function is always activating either the new.x or edit.x states. Shouldn't that last state change be triggered when the invoice is selected.
>>>>>>
>>>>>>No attachment BTW
>>>>>
>>>>>There is an attachment, I re-checked. Please see at the top of my message. I am not sure I understood your point.
>>>>
>>>>You are calling selectView() from most tab selects and AFAICS that triggers $state.go to your edit/new views. If you don't want them to show up then don't go to that state until an invoice is selected.
>>>>
>>>
>>>I want to go to the invoices view (list of invoices) when I click on the invoice tab.
>>>I do not want to also activate the details view at the same time (only when I click on the individual invoice in that grid). That's why I think that this state is wrong. Do you know how to change that state?
>>
>>Yes. READ WHAT I SAID ABOVE
>>>
>>>
>Yes, I read it. The state I'm referring to here is this:
>
>
> .state('edit.invoices', {
>                url: '/invoices:invoiceId?accountNameHash?isNew',
>                views: {
>                    'invoices': {
>                        templateUrl: '/CustomerAccounts/accounts/EditAccountInvoices',
>                        controller: 'invoicesSearchController'
>                    },
>                    'detail': {
>                        templateUrl: '/CustomerAccounts/invoices/editForm',
>                        controller: 'invoicesCrudController'
>                    }
>                }
>            })
>
>I am saying that this is wrong. It should not include 2 named views. I was asking how it should be re-defined.

Maybe nest the detail state/view within the edt.invoices (ie. another state edit.invoices.detail)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform