philippfrenzel/yii2-dynatable
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
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
}
philippfrenzel/yii2-dynatable 适用场景与选型建议
philippfrenzel/yii2-dynatable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.78k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 10 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「Dynatable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 philippfrenzel/yii2-dynatable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 philippfrenzel/yii2-dynatable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 philippfrenzel/yii2-dynatable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
This is a Laravel 5 package for the server and client side of DataTables (http://datatables.net/)
Pager & DataGrid bundle for Symfony
A facade for using the dynatable format
Very simple server-side Dynatable handler for Laravel 5
SCEditor, a lightweight WYSIWYG BBCode & HTML editor extension for Yii 2.0 Framework
统计信息
- 总下载量: 4.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-11