2017-04-06 8 views
0

私は、更新されたアカウントイベントをリッスンし、関連付けられた連絡先とユーザーを取得するLightningコンポーネントを持っています。次に、連絡先のアカウントが表示され、連絡先とユーザーの合計が表示され、繰り返すタイルを含むSLDSカードが作成されます。aura:評価していない場合、aura:繰り返しが表示されない

連絡先の読み込み中にヘッダーを「読み込み中」に変更するまではうまくいきました。私は2つの新しい属性を追加しました(1つは読み込みステータスを保持し、もう1つは連絡先とユーザーの合計を保持します)。そして、これらの属性を更新するロジックを追加しました。どういうわけかこれは壊れてしまったので、どのように壊れているのか分かりません。

コンソールとデバッグログによれば、すべて正常です。連絡先とユーザーはApexコントローラから正しく取得されており、これらの値は属性に書き込まれています。しかし、何も更新されていません。

ContactTable.cmp

<header class="slds-media slds-media--center slds-has-flexi-truncate"> 
 
    <div class="slds-media__body"> 
 
     <h2> 
 
      <span class="slds-text-heading--large"> 
 
       <aura:if istrue="{!v.accountName}"> 
 
        Contacts For {!v.accountName}: {!v.contactsLoadingStatus} 
 
        <aura:set attribute="else"> 
 
         Contacts: - Please Select a Clinic - 
 
        </aura:set> 
 
       </aura:if> 
 
      </span> 
 
     </h2> 
 
    </div> 
 
</header> 
 

 
......... 
 
(Contacts Tile Iterator) 
 
......... 
 

 
<aura:if istrue="{!v.contacts.length > 0}"> 
 
    <h2 style="padding-left: 1.5rem;"><span class="slds-text-heading--medium">Contacts</span></h2> 
 
    <div class="slds-card__body--inner slds-grid slds-wrap" style="margin-bottom: 30px; height: 20rem;  overflow: auto; border: 1px solid rgba(128, 128, 128, 0.32); border-radius: 10px;"> 
 
     <aura:iteration items="{!v.contacts}" var="singleContact"> 
 
      <c:ContactTableContactCard singlecontact="{!singleContact}" /> 
 
     </aura:iteration> 
 
    </div> 
 
</aura:if>

ContactTableController.js

handleUpdateAccountEvent: function(component, event, helper){ \t \t 
 
    helper.updateAccount(component, event); 
 
    component.set('v.selectedContacts', null); 
 
    component.set('v.total', 0); 
 

 
    console.log('Account ID: ' + component.get('v.accountID')); 
 
    console.log('Account Name: ' + component.get('v.accountName')); 
 

 
    if(component.get('v.accountID')){ 
 
    console.log('Grabbing contacts and team members'); 
 
    component.set('v.contactsLoadingStatus', 'Loading...'); 
 
    helper.setContacts(component, helper); 
 
    helper.setTeamMembers(component, helper); \t \t 
 
    } 
 
    else{ 
 
    component.set('v.contacts', null); 
 
    component.set('v.teamMembers', null); 
 
    } 
 
},

ContactTableHelper.js

setContacts: function (component, helper) { 
 
    var action = component.get("c.getContacts"); 
 
    var accountID = component.get("v.accountID"); 
 
    action.setParams({'accountId':accountID}); 
 

 
    action.setCallback(this, function(response){ 
 
    if(component.isValid()){ 
 
     var state = response.getState(); 
 
     if(state === 'SUCCESS'){ 
 
     var contacts = response.getReturnValue(); 
 
     component.set("v.contacts", contacts); 
 

 
     var total = component.get("v.total"); 
 
     total += contacts.length; 
 
     component.set("v.total", total); 
 

 
     component.set("v.contactsLoadingStatus", total + " Records"); 
 

 
     contacts = component.get('v.contacts'); 
 
     console.log('Grabbing contacts.... Done'); 
 
     console.log('contacts:'); 
 
     console.log(contacts); 
 

 
     } 
 
     else{ 
 
     console.log('There was an issue in retrieving the contacts.'); 
 
     console.log(state); 
 
     if(state === 'ERROR'){ 
 
      var errors = response.getError; 
 
      for(var i = 0; i < errors.length; i++){ 
 
      console.log(errors[i].message); 
 
      } 
 
     } 
 
     } 
 
    } 
 
    }); 
 

 
    $A.enqueueAction(action); 
 
    console.log('Grabbing contacts....'); 
 
}, 
 

 
updateAccount: function(component, event){ 
 
    var accountID = event.getParam("accountID"); 
 
    component.set("v.accountID", accountID); 
 

 
    var accountName = event.getParam("accountName"); 
 
    component.set("v.accountName", accountName); 
 
    console.log('finished updateAccount'); 
 
},

それは同じであるので、私はsetContactsとして、多かれ少なかれ、setTeamMembersを残しました。

関連コンソールログ:

はupdateAccount

アカウントIDを終えた:001F0000013YX5DIAW

アカウント名:〜NAME〜。完了の連絡先とチームメンバーの連絡先をつかん

をつかん

....

チームメンバーをつかむ....コンタクトをつかむ

....

連絡先:

[オブジェクト、オブジェクト、オブジェクト]

G

teamMembers完了rabbingチームのメンバー....:

[オブジェクト、オブジェクト、オブジェクト、オブジェクト、オブジェクト、オブジェクト]

答えて

0

は、私はそれを考え出しました。私は他の誰がこの問題に走るのであれば、あなたのスペルをチェック

<aura:if istrue="">

<aura:if isTrue="">

を変え、私のIDEのコードフォーマッタを使用しました。

関連する問題