
Product
Socket Zero Introduces Automated Remediation PRs
Put vulnerability remediation on autopilot with automated security patches and intelligent dependency upgrades across your GitHub repositories.
sitchi/phalcon-datatables
Advanced tools
This is a Phalcon Framework adapter for DataTables.
composer.json file inside your project directory{
"require": {
"sitchi/phalcon-datatables": "2.*"
}
}
composer updateIt uses Phalcon QueryBuilder for pagination in DataTables.
In example we have a stantart MVC application, with database enabled. Don't need to provide a normal bootstrap PHP file, for Phalcon documentation, visit official site.
<?php
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();
}
}
}
<?php
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();
}
}
}
<?php
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();
}
}
}
<?php
/**
* @property integer id
* @property string name
* @property string email
* @property float balance
*/
class User extends \Phalcon\Mvc\Model {
}
<html>
<head>
<title>Simple DataTables Application</title>
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable({
serverSide: true,
ajax: {
url: '/test/index',
method: 'POST'
},
columns: [
{data: "id", searchable: false},
{data: "name"},
{data: "email"},
{data: "balance", searchable: false}
]
});
});
</script>
</head>
<body>
<table id="example">
<thead>
<th>ID</th>
<th>Username</th>
<th>Email</th>
<th>Balance</th>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>
For more examples please search in site directory.
It contains basic Phalcon bootstrap page to show all Phalcon-DataTables functionality.
FAQs
DataTables adapter for Phalcon Framework
We found that sitchi/phalcon-datatables demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Product
Put vulnerability remediation on autopilot with automated security patches and intelligent dependency upgrades across your GitHub repositories.

Product
Socket Zero automates vulnerability remediation with upgrades and targeted patches, including fixes for 100% of known, patchable RubyGems CVEs.

Product
Explore Socket’s redesigned Alerts UI, multi-branch repository monitoring, and new tools for resolving findings, searching scans, and filtering security alerts.