From the course: Design the Web: Creating a Sortable Table
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Setting a default sort on page load
From the course: Design the Web: Creating a Sortable Table
Setting a default sort on page load
- [Voiceover] So now after writing one line of code, we have a sortable table using this plugin. So now what we're going to do is have the table automatically sort based on one of these individual table headings when the page loads. Now if we go back to our HTML file, we'll see that the HTML is in a specific order. Styling form elements here is at the top, with its date, and then CSS controlled SBG. So when the browser loads this page, this is the order that all the HTML gets loaded into the browser's RAM. So what we're gonna do back in the JavaScript file is change this when the page loads. So inside of the parenthesis for table sort order, we can add a couple of additional options. So the first thing we'll need to do is add a beginning and ending curly bracket inside of the parenthesis. This way we can add additional options inside of the table sorter function. And now let's split that open and inside here, let's add our first parameter, or our first property, which is called sort…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Preparing the HTML file3m 13s
-
(Locked)
Activating the plugin6m 2s
-
(Locked)
Setting a default sort on page load3m 24s
-
(Locked)
Highlighting the sorted column4m 54s
-
(Locked)
Creating CSS triangles to indicate sort order4m 34s
-
(Locked)
Creating custom sort properties8m 16s
-
(Locked)
Where to go from here55s
-