Target select dropdown element, created outside initComplete

Target select dropdown element, created outside initComplete

dthelpdthelp Posts: 1Questions: 1Answers: 0

I have a few columns class="list", which use select box as element for filtering the rows.

Now, I'm trying to fill all these selects with distinct column values.

How can I access the column if select is created outside the init function?

initComplete: function () {
    this.api().columns([6]).every( function () {
        var column = this;

           // select = selector of this column select box

        column.data().unique().sort().each( function ( d, j ) {
            //select.append( '<option value="'+d+'">'+d+'</option>' );
        });

    });
}

Answers

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921

    Not sure I totally understand your question. Do you mean how do you add the filters to only the columns with the class "list"? Assuming you are using the second thead for the selects this example should help you get started:
    http://live.datatables.net/saqozowe/70/edit

    Kevin

This discussion has been closed.