PHPackages                             nineinchnick/edatatables - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. nineinchnick/edatatables

ActiveLibrary[Framework](/categories/framework)

nineinchnick/edatatables
========================

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

1.10.6(11y ago)173.2k10[4 issues](https://github.com/nineinchnick/edatatables/issues)BSD-3-ClauseJavaScriptPHP &gt;=5.3.0

Since May 22Pushed 11y ago5 watchersCompare

[ Source](https://github.com/nineinchnick/edatatables)[ Packagist](https://packagist.org/packages/nineinchnick/edatatables)[ RSS](/packages/nineinchnick-edatatables/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (9)Used By (0)

Goal of this widget/wrapper is to provide a drop in replacement for base CGridView widget from the [Yii framework](http://yiiframework.com), using [DataTables](http://datatables.net) plugin.

It's usable, but feedback is needed. Please post issues on [project's page](https://github.com/nineinchnick/edatatables/issues).

\##Features

- Redrawing of table contents (after paging/sorting/searching) using AJAX calls;
- Using CGridView columns definition format, supports all basic special columns like Buttons, Checkbox, etc;
- Custom buttons in table header;
- Smoothness theme from JUI by default;
- Twitter Bootstrap support through the [bootstrap extension](http://www.yiiframework.com/extension/bootstrap);
- Partial editable cells support.

\##Requirements

- Yii 1.1.8 or above;
- PHP 5.3;
- (optional) [Bootstrap extension](http://www.yiiframework.com/extension/bootstrap).

\##Usage

It's not 100% compatible with CGridView. I've decided not to alter the GET parameter names used by DataTables, so you have to use the provided EDTSort and EDTPagination classes as well as alter filter processing. See below.

\###Installation

Extract into extensions dir, or use composer: `$ composer require nineinchnick/edatatables:dev-master`

Import in config/main.php

```
'import' => array(
        ...
        'ext.edatatables.*', //if it's in your extensions folder
        'vendor.nineinchnick.edatatables.*', //if you're using composer (and have a 'vendor' alias!)
        ...
)
```

\###Using

Use similar to CGridView. If displayed in a normal call just run the widget. To fetch AJAX response send json encoded result of $widget-&gt;getFormattedData().

The action in a controller:

```
$widget = $this->createWidget('ext.edatatables.EDataTables', array(
 'id'            => 'products',
 'dataProvider'  => $dataProvider,
 'ajaxUrl'       => $this->createUrl('/products/index'),
 'columns'       => $columns,
));
if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
  $this->render('index', array('widget' => $widget,));
  return;
} else {
  echo json_encode($widget->getFormattedData(intval($_REQUEST['sEcho'])));
  Yii::app()->end();
}
```

The index view (for non-ajax requests):

```

```

\###Preparing the dataprovider

To use features like sorting, pagination and filtering (by quick search field in the toolbar or a custom advanced search filter form) the dataprovider object passed to the widget must be prepared using provided EDTSort and EDTPagination class and CDbCriteria filled after parsing sent forms.

The simplest example:

```
$criteria = new CDbCriteria;
// bro-tip: $_REQUEST is like $_GET and $_POST combined
if (isset($_REQUEST['sSearch']) && isset($_REQUEST['sSearch']{0})) {
    // use operator ILIKE if using PostgreSQL to get case insensitive search
    $criteria->addSearchCondition('textColumn', $_REQUEST['sSearch'], true, 'AND', 'ILIKE');
}

$sort = new EDTSort('ModelClass', $sortableColumnNamesArray);
$sort->defaultOrder = 'id';
$pagination = new EDTPagination();

$dataProvider = new CActiveDataProvider('ModelClass', array(
    'criteria'      => $criteria,
    'pagination'    => $pagination,
    'sort'          => $sort,
))
```

An advanced example would be based on a search form defined with a model and a view. Its attributes would be then put into a critieria and passed to a dataProvider.

\###Other options

Check out the [DataTables web page](http://datatables.net) for docs regarding:

- Table layout
- Styling
- Multi-column sorting etc.
- Some examples and funky plugins

\###Using with Twitter Bootstrap

Since the *bootstrap* attribute has been removed, please use the following configuration in the widget factory or as a default skin for your bootstrap theme:

```
'EDataTables' => array(
    'htmlOptions' => array('class' => ''),
    'itemsCssClass' => 'table table-striped table-bordered table-condensed items',
    'pagerCssClass' => 'paging_bootstrap pagination',
    'buttons' => array(
        'refresh' => array(
            'tagName' => 'a',
            'label' => '',
            'htmlClass' => 'btn',
            'htmlOptions' => array('rel' => 'tooltip', 'title' => Yii::t('EDataTables.edt',"Refresh")),
            'init' => 'js:function(){}',
            'callback' => 'js:function(e){e.data.that.eDataTables("refresh"); return false;}',
        ),
    ),
    'datatableTemplate' => "t",
    'registerJUI' => false,
    'options' => array(
        'bJQueryUI' => false,
        'sPaginationType' => 'bootstrap',
        //'fnDrawCallbackCustom' => "js:function(){\$('a[rel=tooltip]').tooltip(); \$('a[rel=popover]').popover();}",
    ),
    'cssFiles' => array('bootstrap.dataTables.css'),
    'jsFiles' => array(
        'bootstrap.dataTables.js',
        'jdatatable.js' => CClientScript::POS_END,
    ),
),
```

\##Resources

- GitHub:
- Composer package named [nineinchnick/edatatables](https://packagist.org/packages/nineinchnick/edatatables)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~140 days

Recently: every ~18 days

Total

6

Last Release

4086d ago

Major Versions

0.9.3 → 1.0.02015-02-07

0.9.4 → 1.0.12015-02-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/795177?v=4)[Jan Waś](/maintainers/nineinchnick)[@nineinchnick](https://github.com/nineinchnick)

---

Top Contributors

[![nineinchnick](https://avatars.githubusercontent.com/u/795177?v=4)](https://github.com/nineinchnick "nineinchnick (34 commits)")[![igorsantos07](https://avatars.githubusercontent.com/u/532299?v=4)](https://github.com/igorsantos07 "igorsantos07 (6 commits)")

### Embed Badge

![Health badge](/badges/nineinchnick-edatatables/health.svg)

```
[![Health](https://phpackages.com/badges/nineinchnick-edatatables/health.svg)](https://phpackages.com/packages/nineinchnick-edatatables)
```

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
