Switch between regex and smart filter

Switch between regex and smart filter

jpbjpb Posts: 3Questions: 0Answers: 0
edited December 2012 in General
Hello all,

Predominately, i use smart filtering which works very well for my use. However, I have received a request to enable regex filtering as an option. I was hoping to write an extra that would place a checkbox next to the global search box that would enable/disable regex filtering. The issue I have is attempting to change that functionality when checked.

The API example (http://datatables.net/examples/api/regex.html) accomplishes this task by creating a second global search box, that sends the filter command [fnFilter()] each time there is a click or keyup. As stated before, my preference is to change the default behavior. Also, I don't see an identifier on the global search box similar to the API example.

Any suggestions on how to accomplish this?

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    It sounds like you might want to create a feature plug-in that provides this ability: http://datatables.net/blog/Creating_feature_plug-ins . The default filter itself is basically just a wrapper around fnFilter, so you'd need to create a text input, your checkbox and on each key press check how the fnFilter call should due done (as regex / smart filter).

    Allan
  • jpbjpb Posts: 3Questions: 0Answers: 0
    Thanks for the help. Writing a feature plug-in looks a little intimidating, but I have three or four ideas, if I can figure it all out.
This discussion has been closed.