Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default rules not being selected with bt-selectpicker enabled #974

Open
sportinsightsmedia opened this issue Jun 23, 2023 · 1 comment
Open

Comments

@sportinsightsmedia
Copy link

We were experiencing a bug that prevented default rules from being applied when the bt-selectpicker plugin was enabled.

If anyone else has the same issue, we got round it by changing the render calls to refresh in the bt-selectpicker plugin definition. ie changed this...

    this.on('afterUpdateRuleFilter', function(e, rule) {
        rule.$el.find(Selectors.rule_filter).selectpicker('render');
    });

    this.on('afterUpdateRuleOperator', function(e, rule) {
        rule.$el.find(Selectors.rule_operator).selectpicker('render');
    });

...to this...

    this.on('afterUpdateRuleFilter', function(e, rule) {
        rule.$el.find(Selectors.rule_filter).selectpicker('refresh');
    });

    this.on('afterUpdateRuleOperator', function(e, rule) {
        rule.$el.find(Selectors.rule_operator).selectpicker('refresh');
    });
@sportinsightsmedia
Copy link
Author

Another update after revisiting this after a while. There seems to be some sort of incompatibility between QueryBuilder + SelectPicker and Bootstrap5, so in the end we ended up removing the above lines of code completely and replacing them with the following:

var self = this;
this.on('afterAfterInit', function() {
    self.$el.find(Selectors.rule_filter).selectpicker('refresh');
    self.$el.find(Selectors.rule_operator).selectpicker('refresh');
    self.$el.find(Selectors.rule_value).selectpicker('refresh');
} );

which also requires the following line of code added to the end of the QueryBuilder.prototype.init method:

this.trigger('afterAfterInit');

We also had to use this version of SelectPicker: https://gist.github.com/mattymatty76/c996d3b77f298b2ec133be59992df9d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant