open-admin
open-admin copied to clipboard
$form->belongsToMany list in selection modal is losing its events after page change.
Describe the bug
When the list in the select modal of $form->belongsToMany
has paging, after the page is changed, the checkbox events of the list are gone.
To Reproduce
Create a $form->belongsToMany()
with more than 10 selectable records. Open the select modal, change page, select a record and hit submit. The selected record is not added to the belongsToMany list.
Expected behavior It should add the selected record.
System
- Open-admin version 1.0.27
- PHP version 8.2
- Laravel Version 10
- OS: Linux / Win / Mac
- Browser chrome
Solution
After some debugging, I found some remarked code in open-admin/resources/assets/open-admin/js/open-admin-selectable.js
:
/*
// now handeled through admin.ajax.currentTarget
if (event.target.classList.contains('page-link')){
load(event.target.getAttribute("href"));
event.preventDefault();
event.stopPropagation();
return false;
}
*/
When I unremark it, the selection of records keep working after page change.
@bytebrain thanks for the support!