<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
innovationdothome / phalcon-datatables-fork example snippets
use \DataTables\DataTable;
class TestController extends \Phalcon\Mvc\Controller {
public function indexAction() {
if ($this->request->isAjax()) {
$builder = $this->modelsManager->createBuilder()
->columns('id, name, email, balance')
->from('Example\Models\User');
$dataTables = new DataTable();
$dataTables->fromBuilder($builder)->sendResponse();
}
}
}
use \DataTables\DataTable;
class TestController extends \Phalcon\Mvc\Controller {
public function indexAction() {
if ($this->request->isAjax()) {
$resultset = $this->modelsManager->createQuery("SELECT * FROM \Example\Models\User")
->execute();
$dataTables = new DataTable();
$dataTables->fromResultSet($resultset)->sendResponse();
}
}
}
use \DataTables\DataTable;
class TestController extends \Phalcon\Mvc\Controller {
public function indexAction() {
if ($this->request->isAjax()) {
$array = $this->modelsManager->createQuery("SELECT * FROM \Example\Models\User")
->execute()->toArray();
$dataTables = new DataTable();
$dataTables->fromArray($array)->sendResponse();
}
}
}
/**
* @property integer id
* @property string name
* @property string email
* @property float balance
*/
class User extends \Phalcon\Mvc\Model {
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.