-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Bootstrap ButtonGroup clientEvent not being assigned properly. #8028
Comments
What's your issue exactly? What are you trying to do? How to reproduce it? |
I am trying to hook up $('#myDropdown').on('show.bs.dropdown', function () {
// do something…
}) And for that i suppose to use return ButtonDropdown::widget([
...
'clientEvents' => ['show.bs.dropdown' => 'function() {...}']
]); It binds this event to the dropdown itself but not to the parent, so it doesn't work. I think ButtonDropdown should attach these |
Most probably. Any idea on how to fix it? |
What if we assign protected function registerClientEvents()
{
if (!empty($this->clientEvents)) {
$id = $this->containerOptions['id'];
$js = [];
foreach ($this->clientEvents as $event => $handler) {
$js[] = "jQuery('#$id').on('$event', $handler);";
}
$this->getView()->registerJs(implode("\n", $js));
}
} Or better just accept |
Issue moved to yiisoft/yii2-bootstrap#112 |
Hello
As stated here: http://getbootstrap.com/javascript/#dropdowns-events
But parent container for widget is being rendered via
Html::beginTag
and we cannot assign any events to it with 'clientEvents' option.The text was updated successfully, but these errors were encountered: