Как изменить атрибуты существующей таблицы типов полей - PullRequest
1 голос
/ 23 мая 2019

Я пытаюсь изменить атрибут (который отображает значение в браузере) таблицы типа поля с помощью метода addFields ().Проблема в том, что таблицы не имеют значения атрибута, они используют какую-то объектную модель.Я не знаю имя атрибута ведьмы, если я буду использовать.

Я пытался использовать ng-модель, item.name ..

Метод:

$this->crud->modifyField($name, $modifs_array);

Поле моей таблицы:

    $this->crud->addField([ // Table
        'name'            => 'options',
        'label'           => 'Options',
        'type'            => 'table',
        'entity_singular' => 'option',
        'model'=>'App\Models\Ticket',
        'columns'         => [
            'name'  => 'Name',
            'price' => 'Price',
        ],
        'max'             => 5, 
        'min'             => 1, 
    ]);

Исходный код из поля генерации: Опции

<input class="array-json" type="hidden" id="options" name="options">

<div class="array-container form-group">

 <table class="table table-bordered table-striped m-b-0" ng-init="field = '#options'; items = []; max = 5; min = 1; maxErrorTitle = 'Cannot add new option'; maxErrorMessage = 'Maximum number of 5 reached'">
        <thead>
            <tr><th style="font-weight: 600!important;"> Name</th>
            <th style="font-weight: 600!important;"> Price</th>
            </tr>
        </thead>

        <tbody ui-sortable="sortableOptions" ng-model="items" class="table-striped">

            <tr ng-repeat="item in items" class="array-row">
                <td><input class="form-control input-sm" type="text" ng-model="item.name"></td>
                <td><input class="form-control input-sm" type="text" ng-model="item.price"></td>
                <td ng-if="max == -1 || max > 1"><span class="btn btn-sm btn-default sort-handle"><span class="sr-only">sort item</span></tr>

        </tbody>

    </table>
...