|
|
@ -71,12 +71,22 @@ class Widget extends \yii\base\Widget |
|
|
|
$view->registerJs($js); |
|
|
|
$view->registerJs($js); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->registerClientEvents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Registers JS event handlers that are listed in [[clientEvents]]. |
|
|
|
|
|
|
|
* @since 2.0.2 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected function registerClientEvents() |
|
|
|
|
|
|
|
{ |
|
|
|
if (!empty($this->clientEvents)) { |
|
|
|
if (!empty($this->clientEvents)) { |
|
|
|
|
|
|
|
$id = $this->options['id']; |
|
|
|
$js = []; |
|
|
|
$js = []; |
|
|
|
foreach ($this->clientEvents as $event => $handler) { |
|
|
|
foreach ($this->clientEvents as $event => $handler) { |
|
|
|
$js[] = "jQuery('#$id').on('$event', $handler);"; |
|
|
|
$js[] = "jQuery('#$id').on('$event', $handler);"; |
|
|
|
} |
|
|
|
} |
|
|
|
$view->registerJs(implode("\n", $js)); |
|
|
|
$this->getView()->registerJs(implode("\n", $js)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|