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

trigger setSize on refresh event #1398

Closed
wants to merge 1 commit into from

Conversation

georgecoca
Copy link

@georgecoca georgecoca commented May 26, 2016

setSize needs to be executed in order to reflect new size when the options have been populated programmatically (eg. via ajax). This issue happens when listening for show.bs.select and populate the options within that function.

Test case:

$('.selectpicker').on('show.bs.select', function (e) {
        // do ajax request and when done,
        $('.selectpicker').selectpicker('refresh'); // needs to trigger setSize
});

Currently, when the options has been populated via ajax, the dropdown has been already opened and it shows all items (because rendered all li's), and once closed and opened again it shows the correct size. This is because setSize is set only when

this.$button.on('click', function () {
        that.setSize();
});

which the event happens before show.bs.select.

setSize needs to be executed in order to reflect new size when the options have been populated programmatically (eg. via ajax). This issue happens when listening for **show.bs.select** and populate the options within that method.

Test case:
```javasript
$('.selectpicker').on('show.bs.select', function (e) {
        // do ajax request and when done,
        $('.selectpicker').selectpicker('refresh'); // needs to trigger setSize
});
```

Currently when refresh event is triggered it opens the dropdown without size, it shows all items, and once closed and opened again it shows the correct size. This is because setSize is set only when 
```javascript
this.$button.on('click', function () {
        that.setSize();
});
```
@caseyjhol caseyjhol added this to the v1.13.0 milestone Jul 20, 2017
@caseyjhol
Copy link
Member

Available in v1.13.0-alpha.

@caseyjhol caseyjhol closed this Jul 29, 2017
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

Successfully merging this pull request may close these issues.

2 participants