-
Notifications
You must be signed in to change notification settings - Fork 111
Lister with JS paginator can register events more than once #1932
Copy link
Copy link
Closed
Labels
Description
code to reproduce:
$crud = Crud::addTo($app);
$crud->setModel(new Country($app->db));
$crud->addJsPaginatorInContainer(20, 500 /* $containerHeight */);
steps to reproduce:
- open the repro code and scroll the CRUD to be on a newly loaded (via JS paginator) row
- click "edit" icon/action
- notice
Uncaught Error: Unexpected modal to show - modal is already activeconsole error
this is because row events registered by table selector are added by the JS paginator AJAX again:
$('#atk_layout_crud_view_table').on('click', '.b_atk_layout_crud_view_table_table_column_actionbuttons_button_1', function (event) {
event.preventDefault();
event.stopPropagation();
$('#atk_layout_crud_useraction_modalexecutor').modal('show');
$('#atk_layout_crud_useraction_modalexecutor').data('closeOnLoadingError', true);
$('#atk_layout_crud_useraction_modalexecutor_loader').atkReloadView({'url': 'repro.php?__atk_cb_atk_layout_crud_useraction_modalexecutor_loader_callback=callback&__atk_cbtarget=atk_layout_crud_useraction_modalexecutor_loader_callback', 'urlOptions': {'atk_layout_crud_useraction_modalexecutor': $(this).closest('tr').data('id'), 'step': 'fields'}, 'apiConfig': {'method': 'post', 'onSuccess': function () {
$('#atk_layout_crud_useraction_modalexecutor').removeData('closeOnLoadingError');
}}, 'storeName': null});
});
Reactions are currently unavailable