课程: Design the Web: Creating a Sortable Table
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Creating custom sort properties
- [Voiceover] Now we're going to focus our attention on the date column. Now if I come over here and click on the date, it's going to sort the date, but it's going to sort it based on the first letter of the month in the text that's part of the TD tag. So the issue here is that when we don't have enough data inside of this TD element for JavaScript to determine the exact date so the plugin in turn cannot sort these in chronological order. So as I mentioned before, one option is you can put the dates in these particular formats so that the user sees these particular dates and the plugin will be able to sort these chronologically. However, I want to use my own custom labels. I don't want to have a particular time and I don't want to use a number format. So what we're going to do instead is use our own custom labels, anything that we want, and we're going to sort based on a data attribute. So back in the HTML file, inside of our table element, inside of the table body, I have a data-date…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
Preparing the HTML file3 分钟 13 秒
-
(已锁定)
Activating the plugin6 分钟 2 秒
-
(已锁定)
Setting a default sort on page load3 分钟 24 秒
-
(已锁定)
Highlighting the sorted column4 分钟 54 秒
-
(已锁定)
Creating CSS triangles to indicate sort order4 分钟 34 秒
-
(已锁定)
Creating custom sort properties8 分钟 16 秒
-
(已锁定)
Where to go from here55 秒
-