From 79ad62b6264597a48ba57c2e417bc7b26810c4f7 Mon Sep 17 00:00:00 2001 From: Chris Nizzardini Date: Thu, 13 Feb 2014 10:42:26 -0700 Subject: [PATCH] updated test --- test/app/Controller/Component/DataTableComponent.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/app/Controller/Component/DataTableComponent.php b/test/app/Controller/Component/DataTableComponent.php index 3abd286..1722e50 100644 --- a/test/app/Controller/Component/DataTableComponent.php +++ b/test/app/Controller/Component/DataTableComponent.php @@ -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; @@ -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