Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Is it possible to import Collection Tables used in admin somewhere on the frontend?

default discord avatar
double_duckerlast year
4

I am using payload for backend only, but the already implemented table is quite good. Is there a way to reuse them?

  • default discord avatar
    arseniyxlast year

    Do you mean the entire table with all the filters, to use on frontend?

  • default discord avatar
    double_duckerlast year

    Yes exactly.

  • default discord avatar
    arseniyxlast year

    This a bit undocumented territory. I was able to replace the data coming from db to query my api instead:

    https://github.com/shopnex-ai/shopnex-plugins/blob/main/store-plugin/src/components/plugin-list.tsx

    In your case you not need context override but you still need context to subscribe to query string and probably more.



    easiest approach is a bit reverse engineering for example:


    you can look

    https://github.com/payloadcms/payload/blob/70b9cab3932ae3ec02ca3309c3890ea3f1652d65/packages/ui/src/views/List/index.tsx#L37

    to see each providers you will need and just to rewrite the same as you need:


    const { user } = useAuth()
    
      const { getEntityConfig } = useConfig()
      const router = useRouter()
    
      const {
        data,
        defaultLimit: initialLimit,
        handlePageChange,
        handlePerPageChange,
        query,
      } = useListQuery()
    
      const { openModal } = useModal()
      const { setCollectionSlug, setCurrentActivePath, setOnSuccess } = useBulkUpload()
      const { drawerSlug: bulkUploadDrawerSlug } = useBulkUpload()
    
      const collectionConfig = getEntityConfig({ collectionSlug })
    
      const { labels, upload } = collectionConfig
    
      const isUploadCollection = Boolean(upload)
    
      const isBulkUploadEnabled = isUploadCollection && collectionConfig.upload.bulkUpload
    
      const isInDrawer = Boolean(listDrawerSlug)
    
      const { i18n, t } = useTranslation()
    
      const { setStepNav } = useStepNav()
    
      const {
        breakpoints: { s: smallBreak },
      } = useWindowInfo()
  • default discord avatar
    double_duckerlast year

    Thanks!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.