pluginEvents rebind after pjax
Closed this issue · 1 comments
marcuzy commented
I have follow code:
'editableOptions' => [
'header' => 'Amount',
'placement' => \kartik\popover\PopoverX::ALIGN_TOP,
'inputType' => \kartik\editable\Editable::INPUT_SPIN,
'pluginEvents' => [
"editableSuccess" => 'function(event, val, form, data) { console.log('afterEdit'); }',
],
],
After editableSuccess
event plugin rise my handler and I can see "afterEdit" in my console. But if I apply filter for example and pjax reload my grid then I have two new messages ('afterEdit') in my console after editableSuccess instead one new message. How I can detach old handler?
kartik-v commented
Instead of using pluginEvents
call the event in your own javascript at document.ready
and pjax:reload
... you can do off
and then on
in jquery to ensure only one call.