Simplest way to build Data Table (Next.js, Shadcn, React, Tanstack)

Поделиться
HTML-код
  • Опубликовано: 10 дек 2024

Комментарии • 43

  • @orcdev
    @orcdev  3 месяца назад +1

    Hope this tutorial was helpful! ⚔ Join the Mighty Horde! Become a true web dev WARRIOR! ⚔

  • @alexhighgarden6018
    @alexhighgarden6018 3 месяца назад

    this was really helpful thank you!

    • @orcdev
      @orcdev  3 месяца назад +1

      You're welcome! Happy coding! ⚔

  • @kafukai
    @kafukai 3 месяца назад

    Awesome! My method is much complex... 😁 This method simplier and faster, thank you 🙂

    • @orcdev
      @orcdev  3 месяца назад

      You're welcome! This one is really easy to follow.
      Which method were you using, if it's not a secret? :D

    • @kafukai
      @kafukai 3 месяца назад

      @@orcdevtable component of material-ui

  • @anakravitz82
    @anakravitz82 3 месяца назад

    awesome! so easy!

    • @orcdev
      @orcdev  3 месяца назад

      That's why I love Shadcn :D

  • @mozhdeow
    @mozhdeow 27 дней назад

    Thanks bro❤

    • @orcdev
      @orcdev  27 дней назад

      You're welcome! I'm glad you found the content helpful.

  • @MineGene
    @MineGene 3 месяца назад

    some great tips!!

    • @orcdev
      @orcdev  3 месяца назад

      Thank you! I'm glad you find it useful!

  • @maaritswanderlust
    @maaritswanderlust 3 месяца назад

    just what i needed!

    • @orcdev
      @orcdev  3 месяца назад

      Glad to hear that! Enjoy!

  • @devijv1441
    @devijv1441 Месяц назад

    can you make tutorial for filtering array nested column using multiple faceted filter
    i trying filter a tags/roles column with nested array data

    • @orcdev
      @orcdev  Месяц назад +1

      Yes I'm definitely going to cover that in one of my next projects that are coming up with Next.js 15! ⚔️

    • @devijv1441
      @devijv1441 Месяц назад

      @orcdev ok thx u bro

    • @orcdev
      @orcdev  Месяц назад

      @ You’re welcome brother!

  • @steelo2214
    @steelo2214 3 месяца назад

    Great video. You have helped me so much with these shadcn tutorials. But here is one thing, I think the filtering and pagination are only done on the client side. What happens when you want to filter on the backend? I use React Query on the to do multiple queries and then invalidate the cache alright but at work, pagination is implemented on the backend. The nextpage and previous page all come with the data. How do I implement that type of pagination in shadcn’s data table?

    • @orcdev
      @orcdev  3 месяца назад

      So glad to hear I'm helping you out with these tutorials!
      Yeah this one is basically receiving all payments, users or whatever it is from the backend, and filtering it on the client side.
      For backend pagination / filtering you can just send parameters to the backend and based on that query the data.
      I created that tutorial also:
      Pagination: ruclips.net/video/-ajgYf9N68M/видео.html
      Search: ruclips.net/video/kIy6F-VSTCY/видео.html

    • @orcdev
      @orcdev  3 месяца назад

      And thank you very much for your kind words! ⚔

  • @damianmartin15
    @damianmartin15 3 месяца назад

    Hey Orc, are you aware of a way to make shadcn data table row's "drag and drop" able? Thanks

    • @orcdev
      @orcdev  3 месяца назад +1

      Hi! Whole row is a separated component, so it should be easy.
      You could use some library like dndkit.com/ or just native draggable.
      Basically each row should be a draggable component, and you could rearrange them, based on that you could update the backend (depends on the needed feature)

  • @ofeklevy1242
    @ofeklevy1242 3 месяца назад

    Great video

    • @orcdev
      @orcdev  3 месяца назад

      Thank you! Glad you liked it!

  • @princereyes5400
    @princereyes5400 3 месяца назад

    do you have idea how to make a dynamic table? i still thinking about it, i'm using postgre

    • @orcdev
      @orcdev  3 месяца назад +1

      Basically two things that are dynamic in Shadcn table (example from this video) are:
      - columns.tsx - there you determine which columns you have in your table. How it's usually done is that you have that file together with your page where you are displaying your table, and based on your data you set your columns. Technically it could probably be dynamic if you have a lot of repeating data, but not sure if it's worth it to make it dynamic. Usually you have 5 - 6 data tables where you display your data, and you have columns.tsx for each page.
      - data in page.tsx - That's dynamic data that you receive from the backend, and that one is already totally dynamic. data-table.tsx component is receiving dynamic data and columns, and based on that it's displaying what you need.
      What I would suggest you to do is to send data from your postgres db, and just set columns.tsx. You can check on this repo how it's working together with backend:
      github.com/TheOrcDev/orcish-fullstack-admin
      Here is the video also if you need some help:
      ruclips.net/video/W-Bd7nzzz3o/видео.html
      Hope I helped you a little bit, if anything is unclear I'm here :D

    • @princereyes5400
      @princereyes5400 3 месяца назад

      ​@@orcdev Yeah, I understand. But what I mean is how do I insert a new column into an existing database table that already has data?
      For example, I have a set of products with columns like ID, SKU, name, description, and price, which are common for most users. However, some users might want to add additional columns to these existing ones or plan to import their csv. What's your approach to this?
      I've tried creating dynamic tables where the additional columns are stored as type JSONB. This works, but I'm wondering if there's a better way to handle this situation.

    • @orcdev
      @orcdev  3 месяца назад

      @@princereyes5400 In that case I would probably separate those two sources of column data in some external ts file, where I would create some data interface which is exported, and configure columns.tsx to receive that data array.
      One source would be from db which you always have from your backend, and the other source could be totally flexible based on user csv or whatever way they import their data.
      That would be probably the best solution, because that ts file can be covered with unit tests, and you can always ensure / control what is going in the columns.tsx

  • @ThinhBuiGiaMark
    @ThinhBuiGiaMark 2 месяца назад

    is there a possible way to pin the first or last column of the table sir ?

    • @orcdev
      @orcdev  2 месяца назад

      Hi there!
      What do you mean to pin the column? To reorder them or something like that?

    • @acloudonthebluestsky9687
      @acloudonthebluestsky9687 2 месяца назад

      @@orcdev I mean when you can scroll horizontally, the first column should be appear like freeze Header when you scroll down

    • @orcdev
      @orcdev  2 месяца назад

      @@acloudonthebluestsky9687 Ah I get it. It shouldn't be hard, here is the official tutorial from Tanstack:
      tanstack.com/table/v8/docs/guide/column-pinning
      I can make a video also if you want :D

    • @ThinhBuiGiaMark
      @ThinhBuiGiaMark 2 месяца назад

      @@orcdev Thanks, i think i ll tried the solution for that sir

    • @orcdev
      @orcdev  2 месяца назад

      @@ThinhBuiGiaMark Awesome! If you need anything else just let me know ⚔️

  • @Jackdisc567
    @Jackdisc567 3 месяца назад

    No regrets as always.

    • @orcdev
      @orcdev  3 месяца назад

      Thank you my friend! ⚔️

  • @forktrader7870
    @forktrader7870 3 месяца назад

    cumbersome if its included on the form😂

    • @orcdev
      @orcdev  3 месяца назад

      On what do you mean? :D
      I probably said again something wrong hahah

    • @forktrader7870
      @forktrader7870 3 месяца назад

      @@orcdev i want inline table form. but shadcn is kinda limited to have that feature

    • @orcdev
      @orcdev  3 месяца назад

      @@forktrader7870 Oh you mean that. Yeah it's little bit tricky probably. Never tried inline forms with Shadcn before :D

    • @forktrader7870
      @forktrader7870 3 месяца назад

      @@orcdev useForm have hydration error when table tag found on form tag as children. will try to use useFormik as an alternative