我正在使用aslagle:reactive-table
文件:https://github.com/ecohealthalliance/reactive-table
码
{{> 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
怎么做?
答案 0 :(得分: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',
}
}