Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
cnizzardini committed Feb 13, 2014
1 parent 0482adb commit 79ad62b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/app/Controller/Component/DataTableComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class DataTableComponent extends Component{
public $emptyElements = 0;
public $fields = array();

public function __construct(){

}

public function initialize(Controller $controller){
$this->controller = $controller;
$modelName = $this->controller->modelClass;
Expand Down Expand Up @@ -117,17 +121,18 @@ public function getResponse($controller = null, $model=null){
}
$this->setTimes('Filtered Count','stop');
$this->setTimes('Find','start','Cake Find');
$limit = '';

// set sql limits
if( isset($this->controller->request->query['iDisplayStart']) && $this->controller->request->query['iDisplayLength'] != '-1' ){
$start = $this->controller->request->query['iDisplayStart'];
$length = $this->controller->request->query['iDisplayLength'];
$parameters['limit'] = $limit = "$start,$length";
$parameters['limit'] = $length;
$parameters['offset'] = $start;
}

// execute sql select
$data = $this->model->find('all', $parameters);

$this->setTimes('Find','stop');
$this->setTimes('Response','start','Formatting of response');
// dataTables compatible array
Expand Down

0 comments on commit 79ad62b

Please sign in to comment.