Special considerations for displaying a datatable in a modal?

Special considerations for displaying a datatable in a modal?

SkrockiSkrocki Posts: 21Questions: 9Answers: 0

When I run my datatable on the html file titled, for example, tablename.html, everything works fine. When open a second page and then direct a modal at that same address and open the modal by changing the display, I get this error..."Warning: call_user_func() expects parameter 1 to be a valid callback, class 'DataTables\Database\Driver\MysqlQuery' not found in /var/www/dev_claimpenguin/modules/quickschicht/editLists/php/lib/Database.php on line 66

Fatal error: Uncaught Error: Class 'DataTables\Editor\ValidateOptions' not found in /var/www/dev_claimpenguin/modules/quickschicht/editLists/php/lib/Editor/Validate.php:348 Stack trace: #0 /var/www/dev_claimpenguin/modules/quickschicht/editLists/php/table.list_items.php(26): DataTables\Editor\Validate::notEmpty() #1 {main} thrown in /var/www/dev_claimpenguin/modules/quickschicht/editLists/php/lib/Editor/Validate.php on line 348"

I'm not a professional programmer, but it seems like there is a pathing issue. Is there a way to open a datatable in a modal? I've checked the forums and found a few articles about modals but nothing seemed to apply. I am essentially going to use datatables as the list editor for 17 select boxes on my site. The user can set up their own list, in a modal with a datatable. Will this be possible? Is it recommended? I'm wondering if it is too much overhead on page load.

Since this is a dynamic data issue, I'm not sure how to make a fiddle to demonstrate. If the error message is not enough, I'll try to figure some way to show you what I have on my side.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    It almost certainly is due to how the classes are being included (or not as appears to be the case) in your PHP scripts. My guess is that the modals Ajax feed is at a different directory depth from the main page, or something like that.

    Likely you need to adjust the require (or include if you are using that) to address this.

    I'd need to be able to see the PHP code you are using, the locations it is at and also the code on the client-side to help resolve this. Ideally if you could give me a link to the page showing the error and also the PHP I should be able to help address this.

    Allan

  • rf1234rf1234 Posts: 2,990Questions: 87Answers: 421
    edited February 2022

    Is there a way to open a datatable in a modal?

    Yes, there is. I describe one of the possible solutions in this post:
    https://datatables.net/forums/discussion/comment/169522/#Comment_169522

    This is the original post from 2018 that got me started with my solution:
    https://datatables.net/forums/discussion/comment/127970/#Comment_127970

    Since then I've put about a dozen data tables into modals. With and without inline editing. I also made them draggable using jqueryUI if I recall it correctly.

Sign In or Register to comment.