diff --git a/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md b/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md index 0386480e74..b1ddd9270a 100644 --- a/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md +++ b/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md @@ -623,6 +623,8 @@ Strapi includes a predefined `Admin/CM/pages/ListView/inject-column-in-table` ho ```jsx // ./plugins/my-plugin/admin/src/index.js +import get from 'lodash/get'; +import cellFormatter from './components/cellFormatter'; export default { bootstrap(app) { @@ -630,24 +632,27 @@ export default { const isFieldLocalized = get(layout, 'contentType.pluginOptions.i18n.localized', false); if (!isFieldLocalized) { - return displayedHeaders; + return { displayedHeaders, layout }; } - return [ - ...displayedHeaders, - { - key: '__locale_key__', // Needed for the table - fieldSchema: { type: 'string' }, // Schema of the attribute - metadatas: { - label: 'Content available in', // Label of the header, - sortable: false|true // Define in the column is sortable - }, // Metadatas for the label - // Name of the key in the data we will display - name: 'locales', - // Custom renderer - cellFormatter: props =>
Object.keys(props).map(key =>

key

)
, - }, - ]; + return { + layout, + displayedHeaders: [ + ...displayedHeaders, + { + key: '__locale_key__', // Needed for the table + fieldSchema: { type: 'string' }, // Schema of the attribute + metadatas: { + label: 'Content available in', // Label of the header, + sortable: true|false // Define if the column is sortable + }, // Metadatas for the label + // Name of the key in the data we will display + name: 'locales', + // Custom renderer: props => Object.keys(props).map(key =>

key

) + cellFormatter, + }, + ] + }; }); }, }