neam/yii-relations-ui

简化 Yii 1 应用中关系的编辑

安装: 193

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

公开问题: 0

类型:yii-extension

dev-develop 2015-04-29 14:06 UTC

This package is not auto-updated.

Last update: 2024-09-24 01:36:01 UTC


README

简化 Yii 1 应用中关系的编辑。

当前小部件

基于 Handsontable 的多对一关系输入。

在 Yii 1 应用中如下使用

$this->widget('\neam\yii_relations_ui\widgets\HasManyHandsontableInput', [
    'model' => $model,
    'relation' => 'routes',
]);

使用任何自定义列和 handsontable 设置

$this->widget('\neam\yii_relations_ui\widgets\HasManyHandsontableInput', [
    'model' => $model,
    'relation' => 'routes',
    'settings' => [
        'columns' => [
            (object) ['data' => 'id'],
            (object) ['data' => 'route'],
            (object) ['data' => 'canonical', 'type' => 'checkbox', 'checkedTemplate' => 1, 'uncheckedTemplate' => 0], // example of using checkbox to save an attribute of type BOOLEAN NOT NULL
            (object) ['data' => 'route_type_id'],
            (object) ['data' => 'node_id'],
            (object) ['special' => 'delete_checkbox'], // special virtual column to mark which items should be deleted
        ]
    ]
]);

注意:此小部件需要 Yii <- Yii 2 桥接器,可在以下位置找到:https://github.com/neam/yii-yii2-bridge

截图 1 - 在 handsontable 中显示的多对一关系 "routes"

![Handsontable 截图 1](/docs/screenshots/handsontable-screen-1.jpg?raw=true "在 handsontable 中显示的多对一关系 "routes"")

截图 2 - 添加新路由

Handsontable Screenshot 2

截图 3 - 保存后的新路由

Handsontable Screenshot 3