2014-12-04 51 views
0

之一:https://github.com/ecohealthalliance/reactive-table反應表顯示我使用<code>aslagle:reactive-table</code></p> <p>文檔兩個鍵

代碼:

{{> reactiveTable collection=payments settings=reactiveTableSettingsPayments}} 

和我的設置是

reactiveTableSettingsPayments: function(){ 
     return { 
      rowsPerPage: 10, 
      showNavigationRowsPerPage: false, 
      fields: [ 
      { 
       key: 'new_id', 
       label: 'Payment Id', 
       fn: function(value,object){ 
        if(!value){ 
         //here I want old_id if new_id didn't exist 
        } 
       } 
      }, 
      { 
       key: 'buyer_name', 
       label: 'Buyer', 
      } 
} 

爲鑰匙new_id如果該密鑰不存在於我想要顯示的集合中old_id

如何做到這一點?

回答

1
reactiveTableSettingsPayments: function(){ 
     return { 
      rowsPerPage: 10, 
      showNavigationRowsPerPage: false, 
      fields: [ 
      { 
       key: 'new_id', 
       label: 'Payment Id', 
       fn: function(value,object){ 
        if(!value){ 
         return object.old_id; 
        } 
        else{ 
         return falue; 
        } 
       } 
      }, 
      { 
       key: 'buyer_name', 
       label: 'Buyer', 
      } 
} 
相關問題