Yii2 dynatable Widgets

0.1.4 2016-09-30 07:09 UTC

This package is not auto-updated.

Last update: 2024-05-15 16:27:14 UTC


JQuery Dynatable Yii2 Extension JQuery from:

Yii2 Extension by

Latest Stable Version Build Status Code Climate Version Eye License


Package is although registered at - so you can just add one line of code, to let it run!

add the following line to your composer.json require section:


And ensure, that you have the follwing plugin installed global:

php composer.phar global require "fxp/composer-asset-plugin:~1.0"


29-11-2014 Updated to latest 2.2.3 Version of the library


Quickstart Looks like this:

  <?= net\frenzel\dynatable\yii2dynatable::widget([
    'id' => "nameofthetablethatwillbedynamised"

Template for table:

<table id="nameofthetablethatwillbedynamised">
      <th data-dynatable-column="name">Name can contain anything now...</th>
      <th>Favorite Music</th>
      <td>Roller Skating</td>
      <td>Rock Climbing</td>

extended options are:

'clientOptions' => [
    'table' => [
        'defaultColumnIdStyle' => 'trimDash' //can be "underscore" too - look dynatable.js website for more options
    'dataset' => [
        'ajax' => true,
        'ajaxUrl' => Url::to('/your/route/to/json'),
        'ajaxOnLoad' => true,
        'records' => [],
    'features' => [
        'paginate' => false,
        'recordCount' => false,
        'sorting' => true,
        'search' => false
    'params' => [
        //'queries' => 'queries',
        'sorts' => 'sort',
        'page' => 'pageCount',
        'perPage' => 'perPage',
        'offset' => 'offset',
        'records' => 'items',
        'record' => 'item',
        'queryRecordCount' => 'totalCount',
        'totalRecordCount' => 'totalCount'

If you set the params like above, the dynatable should work fine with the build in yii2 rest api.

if you are using ajax, you need to ensure, that the response looks like this:

  "records": [
      "someAttribute": "I am record one",
      "someOtherAttribute": "Fetched by AJAX"
      "someAttribute": "I am record two",
      "someOtherAttribute": "Cuz it's awesome"
      "someAttribute": "I am record three",
      "someOtherAttribute": "Yup, still AJAX"
  "queryRecordCount": 3,
  "totalRecordCount": 3