I have a problem when I put the property "addColumns" in a piece because it does not show the name of the property. This property is defined as "joinByOne". An example of what happens to me:
I tried to put the name of the title with the "partial" property but I didn't get it.
addColumns: [
{
name: '_type',
label: 'Type',
//partial: articleType => articleType.map(articleType => articleType.title).join(' ')
/*partial: function(title) {
if (!value) {
// Don't crash if updatedAt is missing
return '';
}
return self.partial('specialist', { title: title });
}*/
},
]
Is there an effective way to put the title in the column?
Your partial receives the value of the join, which you can call _type
. Since it is a joinByOne
that value will be the entire joined object, not just its title.
So you just need to write:
partial: function(_type) {
if (!_type) {
return 'None';
} else {
return _type.title;
}
}
Note that it is ALWAYS possible for _type
to be null, even if you make it required
, because someone might move the type itself to the trash, etc.