2017 © Pedro Peláez
 

yii2-extension yii2-dynatable

Yii2 dynatable Widgets

image

philippfrenzel/yii2-dynatable

Yii2 dynatable Widgets

  • Friday, September 30, 2016
  • by philippfrenzel
  • Repository
  • 2 Watchers
  • 2 Stars
  • 302 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

yii2-dynatable

JQuery Dynatable Yii2 Extension JQuery from: http://dynatable.com, (*1)

Yii2 Extension by philipp@frenzel.net, (*2)

Latest Stable Version Build Status Code Climate Version Eye License, (*3)

Installation

Package is although registered at packagist.org - so you can just add one line of code, to let it run!, (*4)

add the following line to your composer.json require section:, (*5)

  "philippfrenzel/yii2-dynatable":"*",

And ensure, that you have the follwing plugin installed global:, (*6)

php composer.phar global require "fxp/composer-asset-plugin:~1.0", (*7)

Changelog

29-11-2014 Updated to latest 2.2.3 Version of the library, (*8)

Usage

Quickstart Looks like this:, (*9)

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

Template for table:, (*10)

<table id="nameofthetablethatwillbedynamised">
  <thead>
    <tr>
      <th data-dynatable-column="name">Name can contain anything now...</th>
      <th>Hobby</th>
      <th>Favorite Music</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Fred</td>
      <td>Roller Skating</td>
      <td>Disco</td>
    </tr>
    <tr>
      <td>Helen</td>
      <td>Rock Climbing</td>
      <td>Alternative</td>
    </tr>
    <tr>
      <td>Glen</td>
      <td>Traveling</td>
      <td>Classical</td>
    </tr>
  </tbody>
</table>

extended options are:, (*11)

'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., (*12)

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

{
  "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
}

The Versions

30/09 2016

dev-master

9999999-dev http://www.frenzel.net/

Yii2 dynatable Widgets

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 dynatable

30/09 2016

0.1.4

0.1.4.0 http://www.frenzel.net/

Yii2 dynatable Widgets

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 dynatable

26/09 2016

0.1.3

0.1.3.0 http://www.frenzel.net/

Yii2 dynatable Widgets

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 dynatable

11/10 2015

0.1.2

0.1.2.0 http://www.frenzel.net/

Yii2 dynatable Widgets

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 dynatable

11/10 2015

0.1.0

0.1.0.0 http://www.frenzel.net/

Yii2 dynatable Widgets

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 dynatable