Join Leigh Lawhon for an in-depth discussion in this video Sorting nodes, part of Web Portfolio Projects: Sortable Table and Arrays.
- [Instructor] With our filterNull function…returning rowTd's at the sorterIndex…and the textContent for the values,…we'll jump up all the way back up to line 131.…Instead of passing in data, we're going to pass in…the itemsNotNull as well as the sorterIndex.…Down where our function is called,…we'll make a const for row A…that's going to be equal to Array.from…and we'll pass in the a.childNodes.…
We'll do the same for row B,…and the b value.…Down here where we're hard-coding,…let's delete that.…And now, instead what we want to do is say rowA,…at the sorterIndex,…and let's make sure that our parameter here…is also sorterIndex.…And let's get its textContent.…So textContent will return a string,…and we want a number.…
In order to switch this over to a number,…we're going to use a parseFloat.…Let's do the same for the y value,…and rowB.…We can reuse our nested ternary from our original function…that pushes the values up and down.…And instead of console logging the value,…let's return arr.…Back where the function is called,…
- Sorting your table efficiently
- Filtering null values and sorting nodes
- Sorting algorithms, including merge sort and insertion sort
- Performance testing
- Creating your own algorithm
- Design components
- Adding icons
Skill Level Intermediate
Workflow Tools for Web Developerswith Christina Truong1h 13m Intermediate
What you should know1m 33s
1. Getting Started
2. Sorting Our Table Efficiently
3. Sorting Algorithms
4. Creating Our Own Algorithm
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.