Individual column searching : clear input & reset dropdown

Individual column searching : clear input & reset dropdown

SchmurtzSchmurtz Posts: 5Questions: 2Answers: 0

Hi,

I mix different types of searching in a single table here : http://live.datatables.net/yipolina/7/edit

  • Individual column searching (text inputs) -> column 0
  • Individual column searching (select inputs) -> column 1
  • Custom Individual column searching (select inputs) -> column 2
  • Filter with a checkbox -> column 3

All is fine but I try to make a button to reset / clear search and inputs.

At that time the clear button reset the search (all is displayed when I click my "Clear Filters" button) but not the different inputs (text,select and checkbox) are not erased/reinitialized.

You will see a js function to clear which is able to clear one search input but may be there is a more efficient way...
This is probably not very hard to handle but I don't get it for now....

Thanks !

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 15,787Questions: 25Answers: 3,739
    Answer ✓

    I added the code to clear the inputs. Also it is recommended to just push the search plugin once and leave it there rather then push and pop it. It could become confusing to manage if you have more than one plugin. I updated your example to show how to do this.
    http://live.datatables.net/yipolina/8/edit

    Kevin

  • SchmurtzSchmurtz Posts: 5Questions: 2Answers: 0

    Thank you so much Kevin, that's totally perfect !

    I'm really grateful because I know that what I asked was easy (Seems easy now I see it but I start to work with js about a week ago and I'm not very comfortable with it at the present time :p )

    And thank you again for the big improvement on the checkbox filter : a lot easier and optimized compared to what I've done before !

    :) :) :)

  • kthorngrenkthorngren Posts: 15,787Questions: 25Answers: 3,739

    start to work with js about a week ago

    Good work! You should see some of my old code :blush:

    Kevin

  • Dragonfly_DanceDragonfly_Dance Posts: 1Questions: 0Answers: 0
    edited November 2021

    Thanks for kthorngren, Your code really helped me.

Sign In or Register to comment.