Flattener
Installation
npm install @forestadmin/plugin-flattenerUsage
flattenColumn
flattenColumnconst { flattenColumn } = require('@forestadmin/plugin-flattener');
agent.customizeCollection('customer', collection => {
collection.use(flattenColumn, {
// Name of the column to flatten into the root model
columnName: 'address',
// Subfields to flatten (defaults to all subfields up to the `level` setting)
include: ['street', 'city', 'country:name', 'country:isoCode'],
// Subfields to exclude from flattening (defaults to none)
exclude: [],
// When flattening a subfield, the plugin will flatten all subfields up to the `level` setting.
// Defaults to 1 and is ignored if `include` is specified.
level: 1,
// Either if the newly created columns should be readonly or not (defaults to false)
readonly: true,
});
});flattenRelation
flattenRelationLast updated