承接 nblum/silverstripe-table-field 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nblum/silverstripe-table-field

最新稳定版本:2.0.1

Composer 安装命令:

composer require nblum/silverstripe-table-field

包简介

Allows to edit tables in wysiwyg style

README 文档

README

Allows to edit tables in wysiwyg style. Saves the result in json.

screenshot

Installation

composer require nblum/silverstripe-table-field

Usage

In model

private static $db = [
    'Table' => 'Varchar',
];

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Main', [
        TableField::create('Table', 'Table')
    ]);

    return $fields;
}

public function Table()
{
    return new ArrayList(array_reduce(json_decode($this->dbObject('Table')->value), function ($carry, $row) {
        $carry = is_array($carry) ? $carry : [];
        return array_merge($carry, [['row' => new ArrayList(array_reduce($row, function($carry, $column) {
            $carry = is_array($carry) ? $carry : [];
            return array_merge($carry, [['column' => $column]]);
        }))]]);
    }));
}

In template

<table>
    <% loop $Table %>
        <tr>
            <% loop $row %>
                <%-- Using .RAW lets us but <b> tags in the table fields --%>
                <td>$column.RAW</td>
            <% end_loop %>
        </tr>
    <% end_loop %>
</table>

Configuration

There are no configuration options

Todos

  • add config options for max rows and cols

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-14