Ajax_list not found when Sorting/Filtering in Grocery CRUD

136 views Asked by At

First of all, thank you for such an amazing tool! Although I’m kinda a newbie with CI, its helping me lots!

Now, when integrating GC intro my project I’ve ran myself into an error that I cannot fix by myself. I get the CRUD running fine, and all the fatures are working nicely with the datatables theme, but when I switch to the Bootstrap theme, none of the features work (quick search, sorting, filtering, export, print, you name it). The loading message appears and then does nothing.

I get this error on the console:

Photo of the error

I think it has to do with my routes? maybe? I’ve been stuck the last couples days with it so I’d greatly appreciate any help.

Thank you so much in advance!

Edit: Added my Routes.php code, I don't get where I'm supposed to route the call since I can't find the Ajax_list method anywhere.

<?php

namespace Config;

$routes = Services::routes();

if (is_file(SYSTEMPATH . 'Config/Routes.php')) {
    require SYSTEMPATH . 'Config/Routes.php';
}

$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->setAutoRoute(true);


if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}

$routes->get('/', 'Home::index');
$routes->get('users', 'users::index');
$routes->get('users/(:any)/edit', 'users::edit/$1');
$routes->get('users/(:any)/delete', 'users::delete/$1');
$routes->get('users/login', 'users::login');
$routes->get('users/admin/login', 'admin::login');
$routes->get('users/register', 'users::register');
$routes->get('users/logout', 'users::logout');
$routes->get('users/profile/edit', 'users::edit');
$routes->get('create_forum', 'forum::create_forum');
$routes->get('topic/create', 'forum::create_topic');
$routes->get('(:any)/create_topic', 'forum::create_topic/$1');
$routes->get('topic/(:any)/(:any)', 'forum::topic/$1/$2');
$routes->get('(:any)/(:any)/reply', 'forum::create_post/$1/$2');
$routes->get('itemCRUD', "itemCRUD::lista_colegiados");
$routes->get('itemCRUD/(:num)', "itemCRUD");
$routes->get('itemCRUDShow/(:any)', "itemCRUD::show/$1");
$routes->get('itemCRUD/create', "itemCRUD::create");
$routes->get('itemCRUD/edit/(:any)', "itemCRUD::edit/$1");
$routes->get('itemCRUDUpdate/(:any)', "itemCRUD::update/$1");
$routes->get('itemCRUDDelete/(:any)', "itemCRUD::delete/$1");
$routes->get('documentos', 'itemCRUD::listar_documentos');
$routes->get('paypal/success/(:any)', 'paypal::success/$1');
$routes->get('(:any)', 'pages::view/$1');

Also I tried to trace to where its called but I get stuck at the state_url() method in the Grocery_Crud library.

protected function getAjaxListUrl()
{
    return $this->state_url('ajax_list');
}

protected function state_url($url = '', $is_list_page = false)
{
    //Easy scenario, we had set the crud_url_path
    if (!empty($this->crud_url_path)) {
        $state_url = !empty($this->list_url_path) && $is_list_page?
            $this->list_url_path :
            $this->crud_url_path.'/'.$url ;
    } else {
        //Complicated scenario. The crud_url_path is not specified so we are
        //trying to understand what is going on from the URL.
        $segment_object = $this->get_state_info_from_url();
        $segment_position = $segment_object->segment_position;

        $state_url_array = array();
        $segments = explode('/', uri_string());

        if( sizeof($segments) > 0 ) {
            foreach($segments as $num => $value) {
                $state_url_array[$num] = $value;
                if($num == ($segment_position - 1)) {
                    break;
                }
            }
        }

        $operation = $url !== '' ? '/' . $url : '';

        $state_url =  site_url(implode('/',$state_url_array) . $operation);
    }

    return $state_url;
}
0

There are 0 answers