Bug in SearchPanes (Bootstrap 4): Filter input is not cleared

Bug in SearchPanes (Bootstrap 4): Filter input is not cleared

pgerundtpgerundt Posts: 90Questions: 13Answers: 2

Link to test case:
https://datatables.net/extensions/searchpanes/examples/styling/bootstrap4.html

Description of problem:
Type something into "position" input field and click the "x" next to the field. The input is not cleared.

Debugger code:
Input field has classes "dtsp-paneInputButton col-sm form-control search".

Replies

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    Additional information:

    input field is retrieved by
    var searches = _this.dom.container.find('.' + _this.classes.search);
    but _this.classes.search value is
    col-sm form-control search
    which results in
    var searches = _this.dom.container.find('.col-sm form-control search');
    but should be
    var searches = _this.dom.container.find('.col-sm.form-control.search');
    (replace spaces with dots)

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    The following lines should also be changed:

    155     var searches = _this.dom.container.find(_this.classes.search);
    438     var searches = _this.dom.container.find('.' + _this.classes.search);
    573     var subContainers = this.dom.container.find('.' + this.classes.subRowsContainer);
    576     var topRow = this.dom.container.find('.' + this.classes.topRow);
    1592    var searches = this.dom.container.find(this.classes.search);
    1851    if ($$1('div.' + this.classes.container).length === 0) {
    
  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    And another bug:
    Line 1592
    var searches = this.dom.container.find(this.classes.search);
    should be
    var searches = this.dom.container.find('.' + SearchPane.classes.search.split(/\s+/).join('.'));
    because
    - class names have to be concated with '.' (see above)
    - leading dot is missing
    - this.classes.searchcontains the original class names whereas SearchPane.classes.search contains the bootstrap class names

  • colincolin Posts: 15,177Questions: 1Answers: 2,590

    Thanks for pointing these out. We'll take a look and report back later in the week,

    Colin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @pgerundt ,

    The website is using version 1.2.1 of SearchPanes, which is really strange. We are trying to get to the bottom of that.

    The issues that you mentioned has already been fixed and will be included in the next SearchPanes release which we hope will be in the next few weeks.. Take a look at this example. Until then you can access the fix from the nightly builds.

    Thanks,
    Sandy

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    Hi Sandy,

    thank you for this information.
    One last recommendation: I would use something like
    .replace(/\s+/g, '.'))
    or
    .split(/\s+/).join('.'))
    instead of
    .replace(/ /g, '.'))

    So if anyone ever messes up with the class options (multiple spaces, tabs instead of spaces), you won't run into another problem.

    Thanks a lot,

    Pascal

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @pgerundt ,

    Thanks for pointing this out, I've updated the regexs as you've suggested :)

    Again, this will be available in the nightly builds for now.

    Thanks,
    Sandy

  • ofanielofaniel Posts: 1Questions: 0Answers: 0

    Hello. What is the best way track when this fix will be included in the next release instead of only available on nightly? Do you have a specific date planned? Thanks!

  • colincolin Posts: 15,177Questions: 1Answers: 2,590

    We tend to make releases every month or two, so it would be worth checking back regularly. You could also download the nightly build and host them locally, as that would give you the consistency of the script.

    Colin

This discussion has been closed.