定制 philippfrenzel/yii2-dynatable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

philippfrenzel/yii2-dynatable

最新稳定版本:0.1.4

Composer 安装命令:

composer require philippfrenzel/yii2-dynatable

包简介

Yii2 dynatable Widgets

README 文档

README

JQuery Dynatable Yii2 Extension JQuery from: http://dynatable.com

Yii2 Extension by philipp@frenzel.net

Latest Stable Version Build Status Code Climate Version Eye License

Installation

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

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

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

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

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

Changelog

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

Usage

Quickstart Looks like this:

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

Template for table:

<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:

'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
}

统计信息

  • 总下载量: 4.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固