|
|
|
| |
Menu |
|
|
| |
|
|
| |
|
|
|
|
 |
|
This snippet demonstrates adding the following two functionalities to an Databound HTML table:
a) Allowing the user to sort the table in ascending/descending order when the column header is clicked. b) Highlighting the current row when the user mouses over it as well as highlighting the selected row when the user clicks on it.
One very sexy aspect of this implementation is that it makes use of behaviors. Using behaviors, the snippet demonstrates how to add this functionality without having to add alot of javascript/vbscript code each time around. Simply add the behavior to your table and the functionality comes along with it. Since I have to add this type of functionality to just about every single HTML table that I create in a web application, this saves tons of time.
Additional Notes:
Well, the full sourcecode is downloadable. However, the cliffnotes
are shown below. The sourcecode is documented as well and will
explain it all.
a) To add the ability to highlight the current row and "sort by
clicking on the column header" you will need to simply
add the behavior to the table as follows:
<table style="Behavior: url(TableSortAndHighlight.htc)"....>
b) To indication which xml attribute in the xml document is sorted when
you click on the column header, just add the "SortField" attribute
to the html table column. Examples are as follows:
<td SortField="FirstName".....
<td SortField="LastName".....
<td SortField="ResidenceType".....
<td SortField="ResidenceType"....
<td SortField="State">State.....
Yes, this assumes that the xml document is attribute normalized, but
it is not a very big leap to modify to handle xml documents that are
element normalized.
SortingDataIslands.zip
|
|
Featured
Products |
Advertise on
XMLPitstop
|
Our
Sponsors |
Advertise on
XMLPitstop
|
Partners |
|
Friends |
|
Statistics |
4,173 Total Members
5 members(last 30 days)
0 members(last 7 days)
0 members(today)
1,948 Total Discussions
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)
47,487 Total Blog Posts
0 Blogs(last 30 days)
0 Blogs(last 7 days)
0 Blogs(today)
8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)
14,140 Total Resources
0 Resources(last 30 days)
0 Resources(last 7 days)
0 Resources(today)
|
|
|
| |
|