neam/yii-relations-ui

To simplify editing relations in a Yii 1 app

Installs: 193

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii-extension

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

This package is not auto-updated.

Last update: 2024-12-17 02:48:59 UTC


README

To simplify editing relations in a Yii 1 app.

Current widget

Has-many relation input based on Handsontable.

Use in a Yii 1 app as follows:

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

Use any customized columns and handsontable settings:

$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
        ]
    ]
]);

Note: This widget requires Yii <- Yii 2 bridge available at https://github.com/neam/yii-yii2-bridge

Screenshot 1 - A hasMany relation "routes" displayed in handsontable

![Handsontable Screenshot 1](/docs/screenshots/handsontable-screen-1.jpg?raw=true "A hasMany relation "routes" displayed in handsontable")

Screenshot 2 - A new route being added

Handsontable Screenshot 2

Screenshot 3 - The new route after saving

Handsontable Screenshot 3