tigrang / cakephp-datatable

JQuery DataTable plugin server-side processing component for CakePHP
47 stars 29 forks source link

Issue when implementing #19

Closed NEOSolutions closed 11 years ago

NEOSolutions commented 11 years ago

Hi tigrang. First of all thanks for this awesome Plugin.

In the past my dataTableSettings was empty. Recently I updated to the latest master and now I got

var dataTableSettings = {"Registration":{"bServerSide":true,"sAjaxSource":"\/nexus\/solutionscms\/registrations"}};

that throws me an error:

DateTableComponent: Model not specified for request.

you see, the sAjaxSource doesn't come with ?model=Registration

The SolutionsCMS part is the admin prefix. So the view is solutions_index.ctp

<?php
foreach($dtResults as $result) {
    debug($result);
    $this->dtResponse['aaData'][] = array(
        $result['Registration']['razao_social'],
        $result['Registration']['cnpj'],
        $result['Registration']['email'],
        'actions',
    );
}
public $components = array(
        'DataTable.DataTable' => array(
            'Registration'  => array(
                'columns' => array(
                    'razao_social' => 'Razão Social' ,
                    'cnpj'         => 'CNPJ' ,
                    'email'        => 'E-mail' ,
                    'Ações'        => NULL ,
                    // tells DataTable that this column is not tied to a field
                )
            ) ,
            'triggerAction' => '*'
        ) ,
    );
public
    function solutionscms_index()
    {
        $this->layout                  = 'SolutionsCMS.index';
        // $this->Registration->recursive = 0;
        // $this->set( 'registrations' , $this->paginate() );
        $this->DataTable->paginate = array( 'Registration' );
    }
tigrang commented 11 years ago

Please try out the https://github.com/tigrang/cakephp-datatable/tree/bug-fixes branch and see if that fixes it. Thank you.

luisillo26 commented 11 years ago

It worked for me. thanks @tigrang

tigrang commented 11 years ago

Master should be fixed. Closing.