tigrang / cakephp-datatable

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

ajax request is not going through if used in a second action in the same controller #52

Closed salouri closed 10 years ago

salouri commented 10 years ago

After successfully implementing my index.ctp with this plugin, now I am trying to do the same exact thing with another view (view.ctp) that also includes a datatables set. But its not working! The ajax request doesn't go through at all! The response type is always "html". Here is how my view.ctp datatables settings:

in my view action inside the controller (Courses): $this->DataTable->settings = array( 'Course' => array( 'recursive' => 0 ) , 'triggerAction' => array('view') // tried to use array('index', 'view') with no luck ); $this->DataTable->paginate = array('Course');

Any help please?

tigrang commented 10 years ago

Try moving the triggerAction inside of 'Course' array

salouri commented 10 years ago

I have no clue what happened but I tried to copy the same contents of the index.ctp to view.ctp and I found the request goes through as JSON! So I continued modifications to change code to what needs to be in view.ctp and it's working! O_0 I copied the same datatables script before but didn't work before.

So I have one more question here, when you have more than one triggerAction, and I'm putting the settings inside each action (not in the components array), do I still have to include all triggering actions?? or it doesn't matter?