Labels on in individual column searching

Labels on in individual column searching

nutjob4lifenutjob4life Posts: 2Questions: 1Answers: 1

Hi folks! I'm following the example individual column searching and it works great. But now my goal is to replace the empty dropdown menus, i.e.:

var select = $('<select><option value=""></option></select>')…

with a useful label, like:

var select = $('<select><option value="">' + label + '</option></select>')…

but I have no idea how to get the label: either from the <th> that was originally there before the initComplete function replaced it, or from the columns, or from data- attributes, or anywhere.

I am most definitely not a JavaScript developer, so it's probable I'm missing something obvious. Could anyone give me a nudge in the right direction?

This question has an accepted answers - jump to answer

Answers

  • nutjob4lifenutjob4life Posts: 2Questions: 1Answers: 1
    Answer ✓

    Figured it out:

    …
    var column = this;
    var label = this.header().innerHTML;
    var select = $('<select><option value="">' + label + '</option></select>').appendTo(…
    

    Just needed some time away from it, I guess.

    (And one of these days I'll learn JavaScript.)

Sign In or Register to comment.