React Table Sorting

  Рет қаралды 42,008

Code with Voran

Code with Voran

3 жыл бұрын

In this video, I implemented a table with sorting functionality. The column can be ordered in ascending and descending order.
I generated dummy data from mockaroo.com
I used bootstrap for the design. you can get the CDN from the link below.
getbootstrap.com/docs/4.4/get...
If you have any doubts, please comment below.
Don't forget to subscribe and like.
Thank you
Voranzov

Пікірлер: 124
@RagnarD3
@RagnarD3 Жыл бұрын
I struggled with building this out for two days straight, copying from multiple other examples. None of them worked and were extremely complex. This worked, I understand it, was even able to expand on its function with ease in around 30 minutes. Absolutely wonderful. Thank you so much. So much.
@aparnas1613
@aparnas1613 Жыл бұрын
Excellent simple code to do multi column sorting in one go :) I was struggling with lengthy algorithms to find a fix .. It really helped me a lot. Thank u very much for your knowledge share and effort :)
@user-mm1uk3pr5k
@user-mm1uk3pr5k 3 жыл бұрын
THANK YOU!!!! Before this tutorial I had to do SOOO many twisted ways to do sorting! Im glad it appeared to be this easy, thanks to you 👍👍👍
@CodewithVoran
@CodewithVoran 3 жыл бұрын
Welcome. Happy to know that brother
@user-mm1uk3pr5k
@user-mm1uk3pr5k 3 жыл бұрын
@@CodewithVoran I'm more like a sister, but thanx anyway 😅
@CodewithVoran
@CodewithVoran 3 жыл бұрын
@@user-mm1uk3pr5k sorry sister
@piyushaggarwal5207
@piyushaggarwal5207 2 жыл бұрын
true. don't know why everyone is like {label, accessor, sortable} or some library
@matheuspombeiro1675
@matheuspombeiro1675 Ай бұрын
Thanks Voran, you helped me a lot!
@CodewithVoran
@CodewithVoran Ай бұрын
Welcome brother
@paschalynukwuani6930
@paschalynukwuani6930 Жыл бұрын
Your explanation is simply the best. You are an excellent teacher.
@CodewithVoran
@CodewithVoran Жыл бұрын
Welcome brother
@alimammadov3744
@alimammadov3744 Жыл бұрын
@@CodewithVoran Error: Too many re-renders. React limits the number of renders to prevent an infinite loop. i get data as a props and get this error
@arjun-de6dr
@arjun-de6dr 2 жыл бұрын
Good one man, exactly what I was looking for
@CodewithVoran
@CodewithVoran 2 жыл бұрын
thanks arjun
@anangyoga1381
@anangyoga1381 2 жыл бұрын
thank you good sir, it's clear simple and short. awesome!
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome anang
@PadawanNica
@PadawanNica 2 жыл бұрын
Im new in that and sound crazy but you save me today , thank you!
@Voranzov
@Voranzov 2 жыл бұрын
Welcome benjamin
@vigneshlokeshbabu1686
@vigneshlokeshbabu1686 2 жыл бұрын
excellent excellent excellent video..... another simple way of code, another idea of coding... thank u so much sir...
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Thank you vignesh 😍😍. Subscribe to my channel for more useful tutorials
@Dev-Phantom
@Dev-Phantom Жыл бұрын
very informative i applied this concept today
@CodewithVoran
@CodewithVoran Жыл бұрын
Thanks brother
@abcd9967
@abcd9967 2 жыл бұрын
You just saved my life.. thanks for great video 😊
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome brother
@paalaleksander
@paalaleksander 2 жыл бұрын
Thanks a lot! Helped me figure out tables in react
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome paal
@irenek8150
@irenek8150 5 ай бұрын
Thank you so much!! It helped me a lot!
@CodewithVoran
@CodewithVoran 5 ай бұрын
Glad it helped you ❤️❤️
@shashidharrai8110
@shashidharrai8110 2 жыл бұрын
Thank you so much it is a great video and u used the simplest way to do things thank you so much ...
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome brother
@davidverano444
@davidverano444 2 жыл бұрын
Thanks Voran. I'm an Engineer (Facilities / Maintenance , 53 yr old), and i wan to automate some tables, or output for work. Hopefully i will be able to use React to do just that. Your video helps.
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Nice to meet you sir. If you need any help in react, i can help you sir
@vallishbharadwaja9126
@vallishbharadwaja9126 Жыл бұрын
Thank you bro 🙏 It helped a lot
@CodewithVoran
@CodewithVoran Жыл бұрын
Glad it helped
@Sirius39170
@Sirius39170 2 ай бұрын
Thanks for the video!
@CodewithVoran
@CodewithVoran 26 күн бұрын
You're welcome!
@MoMoney75314
@MoMoney75314 2 ай бұрын
Very very helpful, thank you sir.
@CodewithVoran
@CodewithVoran Ай бұрын
You are welcome
@shubhamsinghvi9338
@shubhamsinghvi9338 2 жыл бұрын
Really a great and simple explanation ❤❤❤
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Thanks Singhvi
@prajulsahu9838
@prajulsahu9838 2 жыл бұрын
Thanks man, you saved me today!!!
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome buddy
@analistadesistemas
@analistadesistemas Жыл бұрын
You have a new subscriber!
@CodewithVoran
@CodewithVoran Жыл бұрын
Thanks analista
@RabbagunduMadhavi
@RabbagunduMadhavi Жыл бұрын
This is very interesting . Thanks you because, I solved my problem with your video. before I saw many related videos but i am not able to solve my problem.
@CodewithVoran
@CodewithVoran Жыл бұрын
Glad it helped
@techKnowCoding
@techKnowCoding Жыл бұрын
Awesome man but if you also do for numbers then it will be more than awesome but still loves it
@mvsrcm6413
@mvsrcm6413 2 жыл бұрын
bro ,just saved my life bro , that's it.
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Happy to know 😍😍
@rohitmandaliya
@rohitmandaliya 2 жыл бұрын
thank you so much this video is very helpful
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome rohit
@keerthanachar
@keerthanachar Жыл бұрын
You saved my day :)
@CodewithVoran
@CodewithVoran Жыл бұрын
Happy to know 🥰🥰
@zahidshaikh3122
@zahidshaikh3122 2 жыл бұрын
Bro you just simplified everything in 7-min video.
@CodewithVoran
@CodewithVoran 2 жыл бұрын
thanks a lot brother. subscribe for more tutorials
@BalaramGayen
@BalaramGayen 2 жыл бұрын
Great content Sir 🥰🥰
@CodewithVoran
@CodewithVoran 2 жыл бұрын
thanks Gayen
@AbhishekSingh-ot2dv
@AbhishekSingh-ot2dv 2 жыл бұрын
great video!!
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Thanks abhishek
@ankushdas6896
@ankushdas6896 Жыл бұрын
You saved me brother
@CodewithVoran
@CodewithVoran Жыл бұрын
🥰🥰🥰
@ayoabimbola777
@ayoabimbola777 2 жыл бұрын
Nothing but a lifesaver bro... Thanks a bunch! Can I ask why we are mapping the mock data to state before rendering it?
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Because react components will only re-render when there are chances to state or props
@arunaru7561
@arunaru7561 2 жыл бұрын
Tqs bro u made that easy😙😙
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome bro
@ryroio
@ryroio 2 жыл бұрын
Thank you!
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome. Subscribe for more tutorials
@vishalgatla4606
@vishalgatla4606 Жыл бұрын
Thanks man
@CodewithVoran
@CodewithVoran Жыл бұрын
Welcome vishal
@amankumarsingh7456
@amankumarsingh7456 2 жыл бұрын
thanks bhaiyaji
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Thanks brother
@colton3507
@colton3507 2 жыл бұрын
Nice!! Thanks
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome colton. Subscribe to my channel for more useful tutorials
@zishanali2161
@zishanali2161 Жыл бұрын
Thank brother 😊 I
@CodewithVoran
@CodewithVoran Жыл бұрын
Welcome brother
@mikepl92
@mikepl92 2 жыл бұрын
Great video! How would the sorting work if you are trying to target nested data in a json object?
@CodewithVoran
@CodewithVoran 2 жыл бұрын
you can use optional chaining. refer this documentation developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
@ruhitbaidya1681
@ruhitbaidya1681 4 ай бұрын
wonderfull
@CodewithVoran
@CodewithVoran 4 ай бұрын
Many thanks
@qweqw1359
@qweqw1359 2 жыл бұрын
nice
@juguetestoys1137
@juguetestoys1137 3 жыл бұрын
Excellent video. It would be very powerful to be able to join in REACT both functions: react table sorting with the react search filter table. I have tried to join both concepts but I can't do it. Maybe you know how to do it .... Thank you very much for sharing your knowledge!
@CodewithVoran
@CodewithVoran 3 жыл бұрын
Hi Juguetes. I will do a tutorial of table with both functionalities
@juguetestoys1137
@juguetestoys1137 3 жыл бұрын
You're a great person. Hopefully you will achieve all your dreams !!
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Thanks mate. Thank you for your words
@varshakotwal3407
@varshakotwal3407 Жыл бұрын
@@CodewithVoran plz do it yet u have not done
@sweta3251
@sweta3251 2 жыл бұрын
Hey I need to sort ip address...can you plz help here
@CodewithVoran
@CodewithVoran 2 жыл бұрын
in this case, you don't need to convert toLowercase. a[col] > b[col]
@prempanchal8166
@prempanchal8166 2 жыл бұрын
Great video!! I have a question, How would I be able to sort if one of the fields is empty (null)? Like let's say if some of the email fields are empty, how can I make it sort with empty fields?
@VeraVeraniego
@VeraVeraniego Жыл бұрын
sort all fields and then paste the empty fields at the end
@n.dclothing8529
@n.dclothing8529 Жыл бұрын
great video but what happens when we wantonly one column to be sorted?
@rupalgupta5524
@rupalgupta5524 Жыл бұрын
Hey! How can we give some arrows icon and change it as per the order ?
@ishivamgupta1
@ishivamgupta1 2 жыл бұрын
Thankyouu
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Welcome shivam
@fajarhidayat457
@fajarhidayat457 2 жыл бұрын
but how if i added the new data, then the new data is automatically sorting ? the problem is when the new data is added, the position is lower not automatically sorting... do u have solution in this case?
@arupde6320
@arupde6320 3 жыл бұрын
upload regularly ..
@CodewithVoran
@CodewithVoran 3 жыл бұрын
yes brother. i will
@kekoHere0610
@kekoHere0610 2 жыл бұрын
Hi..this video helped me a lot.But how do you sort a column with numbers as data
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Same way
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Same code
@davilima6995
@davilima6995 2 жыл бұрын
but toLowerCase doesn't break the code?
@trups11trupti
@trups11trupti 2 жыл бұрын
Try this for number: const sortingNumber = () => { if (order === 'DSC') { const sorted = [...orders].sort((a, b) => a.subTotal.exclVat - b.subTotal.exclVat); setOrders(sorted); setOrder('ASC'); } else { const sorted = [...orders].sort((a, b) => b.subTotal.exclVat - a.subTotal.exclVat); setOrders(sorted); setOrder('DSC'); } };
@bishaladhikari8691
@bishaladhikari8691 2 жыл бұрын
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops. could u please help
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Did you use class component?
@bishaladhikari8691
@bishaladhikari8691 2 жыл бұрын
@@CodewithVoran my case was little different , i had try to explain u but it became little long i have to sort from ascending or desending to this data according to price export const products=[ { id:"1", image:"/images/p1.jpg", title:"Brand Levi WHite Tshirt", description:"This impressive paella is a perfect party dish and a fun meal to cook together with yourguests. Add 1 cup of frozen peas along with the mussels, if you like. " , availableSizes:["xs","l","xl"], Price:"$50" }, { id:"2", image:"/images/p2.jpg", title:"Women's New fashion Jacket", description:"This impressive paella is a perfect party dish and a fun meal to cook together with yourguests. Add 1 cup of frozen peas along with the mussels, if you like. ", availableSizes:["x","l","xl"], Price:"$90" }, ] .................................................................. i have to do filter and sort the above data , i had completed the filter but not sort const [items,setItems]=React.useState(products); const filterItem=(item)=>{ const updatedItem=products.filter((product)=>{ return product.availableSizes.indexOf(item)>=0; }); setItems(updatedItem) } const sortItem=(item)=>{ const sorted=[...items].sort((a,b)=> a[item].toLowerCase()>b[item].toLowerCase() ? 1:-1) setItems(sorted); } --------------------------------------------------------------- { items.map((prod)=>(......... ....................... ) ----------------------------------------------------------- in filter.js i have my menu item props.setItems("Price")} >Lowest Highest
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Sorry for the late reply. I'll check and let you know.
@treatfortreat2105
@treatfortreat2105 Жыл бұрын
Hi, Table working fine in local, when code is uploaded to server , table data freeze.
@CodewithVoran
@CodewithVoran Жыл бұрын
hi. which service did you use to host?
@akkishivakumar6502
@akkishivakumar6502 2 жыл бұрын
how to give color on sorting
@marcofabiopavone5027
@marcofabiopavone5027 2 жыл бұрын
How to write this in typescript? I have to declare a type for col. I mean: const sorting = (col: *what type?*) => {...}
@CodewithVoran
@CodewithVoran 2 жыл бұрын
Give 'any' or obj
@DylanL9
@DylanL9 Жыл бұрын
how would you sort integers? do you have code for that?
@blobbyblue02
@blobbyblue02 Жыл бұрын
I converted my integers to strings, that seemed to work fine.
@dude9835
@dude9835 3 ай бұрын
mera data ek api sai aa rha hai mai data,setdata ki place pai ky likhu
@DeadShot-gm1jj
@DeadShot-gm1jj 2 жыл бұрын
why do we have to clone the data [...data], why can't we just use data.sort() ???
@VivekBabuBanasuri-pl4zj
@VivekBabuBanasuri-pl4zj 8 ай бұрын
All the columns are strings, can we do the similar for Number data type in column ? Any one ??
@CodewithVoran
@CodewithVoran 8 ай бұрын
Yes. You can
@rashmanfathima952
@rashmanfathima952 Жыл бұрын
Can I get the source code Sir, Please!
@thebestchillsounds4780
@thebestchillsounds4780 2 жыл бұрын
It doesn't map and rows don't show up. Any help please?
@thebestchillsounds4780
@thebestchillsounds4780 2 жыл бұрын
I found solution :) Maybe some can use it. You MUST refresh the page or restart React to see results of map method :)
@lee4551
@lee4551 Жыл бұрын
Hello, thank you for the vidéo You should remove the music in the background, your voice is enough
@abheemk
@abheemk 3 жыл бұрын
background music is annoying
@CodewithVoran
@CodewithVoran 3 жыл бұрын
sorry brother. I will reduce the sound of background music in upcoming tutorials.
@abheemk
@abheemk 3 жыл бұрын
@@CodewithVoran Great content , appreciated 👌🏻
@CodewithVoran
@CodewithVoran 3 жыл бұрын
@@abheemk thanks brother
Material UI - Table Sorting and Pagination
46:49
Jesus, Take the Compiler
Рет қаралды 20 М.
How To Sort A Table In React (No Libraries)
5:10
Jacob Broughton
Рет қаралды 4,3 М.
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 212 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 28 МЛН
39kgのガリガリが踊る絵文字ダンス/39kg boney emoji dance#dance #ダンス #にんげんっていいな
00:16
💀Skeleton Ninja🥷【にんげんっていいなチャンネル】
Рет қаралды 8 МЛН
You won't BELIEVE what I just did with TanStack's React Tables!
35:58
React Search Filter Tutorial Beginner to Advanced
26:50
Lama Dev
Рет қаралды 259 М.
React JS: Searching and Sorting data
25:18
Index-Zero
Рет қаралды 11 М.
I Never Want to Create React Tables Any Other Way
5:40
Josh tried coding
Рет қаралды 249 М.
Search Filter in React JS - Filter Through Results
8:53
Code Commerce
Рет қаралды 144 М.
React Material UI Table with Paging Sorting and Filtering
44:04
CodAffection
Рет қаралды 97 М.
Custom React Table With Filter and Sorting - No Libraries
21:49
Monsterlessons Academy
Рет қаралды 13 М.
React table with pagination
21:58
Code with Voran
Рет қаралды 39 М.
Makefiles: 95% of what you need to know
1:01:53
Gabriel Parmer
Рет қаралды 117 М.
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 212 МЛН