Clickable (http links) titles -- best way?

Clickable (http links) titles -- best way?

GregPGregP Posts: 487Questions: 8Answers: 0
edited January 2013 in DataTables 1.9
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?

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Daft question, but what toolbar?

    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
  • GregPGregP Posts: 487Questions: 8Answers: 0
    edited January 2013
    Sorry, I thought I was being smart using that term to describe the... title bar...? where the tools (search, sorting, etc) go. The CSS class is "toolbar"...

    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!!
  • GregPGregP Posts: 487Questions: 8Answers: 0
    Hah, it WAS my own function that was doing it... so I'm not making it more expensive by just putting it in there... d'oh! Thanks anyhow!
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    :-) No worries. Good to know you got it sorted out.

    Allan
This discussion has been closed.