This plugin add a drag and droppable list that allows you to sort content type entries.
npm install dcs-drag-drop-content-types-strapi5
Inspired by the Drag-Drop-Content-Type Strapi 4 plugin.
Drag-drop feature completely rewritten to use dndkit because react-sortable-hoc is deprecated and not compatible with React 18.
Install with NPM.
``bash`
npm i dcs-drag-drop-content-types-strapi5`
Install with Yarn.bash`
yarn add dcs-drag-drop-content-types-strapi5
file. Create the file, if it doesn't exist.
`js
export default () => ({
// ...
'drag-drop-content-types': {
enabled: true
}
})
`
2. Run npm run build and restart the app using npm run develop.$3
1. Go to Settings → Drag Drop Content Type → Configuration.
2. Specify the Rank Field Name used for sorting or leave the default field name rank.
3. Add a Number field with Name: myRankFieldName and Number format: integer to the sortable _ContentType_.
4. Configure the view of your _ContentType_ by adding Default sort attribute → rank and Default sort order → ASC to update the view after dragging.
5. If needed: grant permissions for the rank field to your roles.#### Hints
* You can set a
title value that will be displayed in the menu instead of the default field.
* A second field can be displayed in the menu via the subtitle setting. It can be either a string-like field or an object such as a relation, that has a title field as configured in the settings.
* You can enable webhooks to trigger something after updating the order.$3
You can make a request in the frontend to get the ordered items. In this example the _ContentType_ is called Foo and ordered via the rank field. `
http://localhost:1337/api/foo?sort=rank:asc
``