scoumbourdis / grocery-crud-codeigniter-4

GNU General Public License v3.0
68 stars 38 forks source link

XHR/404 error on ajax_list_info (Solved) #15

Closed pauloneill closed 3 years ago

pauloneill commented 3 years ago

First of all, thank you for GroceryCRUD 😃

I think I found an issue: I use the index controller method as a list and if I use FlexiGrid, I get a 404/XHR error when the page tries to access ajax_list_info.

If I explicitly specify the index method, it magically works.

My workaround was to add this to Routes.php $routes->addRedirect('/staff', '/staff/index');

It would be nice if the index() method handled this implicitly as I just wasted a day figuring this out but solved now 😆

Thanks John

scoumbourdis commented 3 years ago

Hello @pauloneill and thanks for the feedback.

This is just the way Codeigniter works and I can't do many thing about it to be honest. But in fact as this is a known issue from the previous version I have a work-around that you can specify the URL on your CRUD. More specifically the function is setApiUrlPath and you can use it like this:

$crud->setApiUrlPath(site_url('/staff/index'), site_url('/'));

I hope this helps

Regards Johnny

pauloneill commented 3 years ago

Thanks Johnny - I just ended up adding redirects in Routes.php config file as I mentioned but I'll check out your way, too.

Regards Paul