Clickable (http links) titles -- best way?
Clickable (http links) titles -- best way?
GregP
Posts: 500Questions: 10Answers: 0
I would like the titles inside my toolbar to be clickable links. I can bury the markup inside the title attribute, but then that messes it up as an actual title (though most tables don't strictly need clean title attributes):
[code]etc..[/code]
As you can see, that's not a well-formatted title attribute. The other option I've gone with thus far is to render the page, and then on document ready, find tables and grab the link from a "data-link" attribute I've created. Then I traverse the DOM to find the title in the toolbar and wrap it up with an anchor tag and HREF set to the data-link value.
[code]etc..[/code]
(grab the value of data-link, hunt down the title, and wrap it up in an appropriate anchor tag)
It works, but I feel like there must be a better way. DT is already building the toolbar DOM nodes, so I wonder if there's a way to specify this behaviour within DT itself. Any advice out there?
[code]etc..[/code]
As you can see, that's not a well-formatted title attribute. The other option I've gone with thus far is to render the page, and then on document ready, find tables and grab the link from a "data-link" attribute I've created. Then I traverse the DOM to find the title in the toolbar and wrap it up with an anchor tag and HREF set to the data-link value.
[code]etc..[/code]
(grab the value of data-link, hunt down the title, and wrap it up in an appropriate anchor tag)
It works, but I feel like there must be a better way. DT is already building the toolbar DOM nodes, so I wonder if there's a way to specify this behaviour within DT itself. Any advice out there?
This discussion has been closed.
Replies
The approach you've taken looks like good progressive enhancement to me, but I'm not quite sure what you mean by the toolbar - if that is a separate component, then it is that with should be adding the extra options.
Allan
It's not a "header" because the table header is where the header names go.
So yeah. The main top bar thing that you can populate with different tools using sDom.
---
It suddenly occurs to me that I may have already made custom code to populate that bar with my table's title attribute. Maybe it's not DT doing it after all. Need to get back up to speed on both the DT API and also my *own* API!!
Allan