最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - How to add new entries to the top instead of the bottom in Strapi's components? - Stack Overflow

programmeradmin0浏览0评论

I am using Strapi CMS to manage a list of entries inside a repeatable component. When I click "Add an entry", the new item always gets added to the bottom of the list. However, I want it to be inserted at the top instead or to make the list automatically sortable according to one of the field i have in content.

Is there a way to modify Strapi’s default behavior to add new entries at the beginning of the list? Any workaround (e.g., modifying the admin panel settings, custom JS override, or backend logic) would be appreciated.

This the code which has the schema to add Content in the Spotlight Page Card

This is how it looks on the CMS panel
This the Content type of how it looks in admin panel

export interface ApiSpotlightPageSpotlightPage extends Schema.SingleType {
  collectionName: 'spotlight_pages';
  info: {
    singularName: 'spotlight-page';
    pluralName: 'spotlight-pages';
    displayName: 'Spotlight Page';
    description: '';
  };
  options: {
    draftAndPublish: true;
  };
  attributes: {
    hero_banner: Attribute.Component<'section.banner'>;
    categories: Attribute.Component<'ui.category', true>;
    cards: Attribute.Component<'ui.spotlight-item', true>;
    createdAt: Attribute.DateTime;
    updatedAt: Attribute.DateTime;
    publishedAt: Attribute.DateTime;
    createdBy: Attribute.Relation<
      'api::spotlight-page.spotlight-page',
      'oneToOne',
      'admin::user'
    > &
      Attribute.Private;
    updatedBy: Attribute.Relation<
      'api::spotlight-page.spotlight-page',
      'oneToOne',
      'admin::user'
    > &
      Attribute.Private;
    sitemap_exclude: Attribute.Boolean &
      Attribute.Private &
      Attribute.DefaultTo<false>;
  };
}
发布评论

评论列表(0)

  1. 暂无评论