Custom filter menu via bootstrap dropdown!!!

Custom filter menu via bootstrap dropdown!!!

kunalvirkkunalvirk Posts: 4Questions: 2Answers: 0

Hi there,

I'm creating a dynamic jQuery table that get its data via JSON, though right now it is static. I want to add custom filter dropdown menu (using bootstrap) with three options i.e. Search, Sort Ascending, Sort Descending.

I've created this https://jsfiddle.net/kunalvirk/jaud6hup/.

Nothing is working right now, as my TDs contains a HTML structure. Can anyone please help me here...!!!

Thanks in advance. :)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    A number of issues I've spotted here.

    1) ordering is disabled, so you won't ever be able to order the table!
    2) sort() will not sort the table. As it's documentation says:

    This method should not be confused with order() which is used to order for records in the DataTable.

    3) You need to redraw the table after an order action.

    https://jsfiddle.net/jaud6hup/4/

    Allan

  • kunalvirkkunalvirk Posts: 4Questions: 2Answers: 0

    Thank you very much allan :) . But how can I make the search input to look into the HTML of columns TD.??? :/

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    You'd need to call the column().search() and then the draw() method, just like you already have done for the footer input elements (although there aren't any there - it looks like some copy / paste code).

    Allan

This discussion has been closed.