PHP Класс kartik\builder\TabularForm

Usage: use kartik\form\ActiveForm; use kartik\builder\TabularForm; $form = ActiveForm::begin($options); // $options is array for your form config echo TabularForm::widget([ 'model' => $model, // your model 'form' => $form, 'gridSettings' => [ 'toolbar' => \yii\helpers\Html::submitButton('Submit') ], 'attributes' => [ 'id' => ['type' => TabularForm::INPUT_STATIC], 'name' => ['type' => TabularForm::INPUT_TEXT], 'description' => ['type' => TabularForm::INPUT_TEXT], 'status' => ['type' => TabularForm::INPUT_CHECKBOX, 'enclosedByLabel' => true], ] ]); ActiveForm::end();
С версии: 1.0
Автор: Kartik Visweswaran ([email protected])
Наследование: extends BaseForm
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$actionColumn the settings for the action column. If set to false, the action column will not be displayed.
$checkboxColumn the settings for the checkbox column. If set to false, the checkbox column will not be displayed.
$compositeKeySeparator the separator for the composite keys available as an array.
$dataProvider the data provider for the tabular form. This property is required. It must return a valid list of models for rendering the tabular form inputs.
$gridClass the namespaced GridView class name. Defaults to '\kartik\grid\GridView'. Any other class set here must extend from '\kartik\grid\GridView'.
$gridSettings the settings for [[GridView]] widget which will display the tabular form content.
$rowHighlight highlight current row if checkbox is checked.
$rowSelectedClass the CSS class to apply to a row when the row is selected.
$serialColumn the settings for the serial column. If set to false, the serial column will not be displayed.

Защищенные свойства (Protected)

Свойство Тип Описание
$_columns the grid columns

Открытые методы

Метод Описание
init ( )
run ( )

Защищенные методы

Метод Описание
checkValidSetting ( string $attr, array $settings, string $key, string $type ) Checks if a setting is of valid type and throws exception if not.
getCellValue ( string $attribute, mixed $settings ) : string Generates a cell value.
getStaticInput ( string $type, Model $model, integer $index, array $settings, string $attribute, Formatter $formatter ) : string Generates the static input
initActionColumn ( ) Initializes the action column.
initCheckboxColumn ( ) Initializes the checkbox column.
initColumn ( string $type ) Initializes special columns
initDataColumns ( ) Initializes the data columns.
initOptions ( ) Initializes the widget options
initSerialColumn ( ) Initializes the serial column.
isColumnSet ( string $type ) : boolean Checks if a grid column is set correctly.
registerAssets ( ) Registers the TabularForm widget assets.
renderGrid ( ) : string Render the grid content.
slash ( string $str = '' ) : string Prepends with a back slash if necessary for full namespace validation.

Описание методов

checkValidSetting() защищенный статический Метод

Checks if a setting is of valid type and throws exception if not.
protected static checkValidSetting ( string $attr, array $settings, string $key, string $type )
$attr string the attribute to check
$settings array the attribute settings
$key string the model key
$type string the attribute input type

getCellValue() защищенный Метод

Generates a cell value.
protected getCellValue ( string $attribute, mixed $settings ) : string
$attribute string the model attribute.
$settings mixed the configuration for the attribute.
Результат string the parsed cell value.

getStaticInput() защищенный Метод

Generates the static input
protected getStaticInput ( string $type, Model $model, integer $index, array $settings, string $attribute, Formatter $formatter ) : string
$type string the static input type.
$model yii\base\Model the data model.
$index integer the zero based index of the item in dataProvider.
$settings array the attribute settings.
$attribute string the attribute.
$formatter yii\i18n\Formatter the formatter instance.
Результат string the generated static input.

init() публичный Метод

public init ( )

initActionColumn() защищенный Метод

Initializes the action column.
protected initActionColumn ( )

initCheckboxColumn() защищенный Метод

Initializes the checkbox column.
protected initCheckboxColumn ( )

initColumn() защищенный Метод

Initializes special columns
protected initColumn ( string $type )
$type string the grid column type (one of 'serial', 'action', 'checkbox')

initDataColumns() защищенный Метод

Initializes the data columns.
protected initDataColumns ( )

initOptions() защищенный Метод

Initializes the widget options
protected initOptions ( )

initSerialColumn() защищенный Метод

Initializes the serial column.
protected initSerialColumn ( )

isColumnSet() защищенный Метод

Checks if a grid column is set correctly.
protected isColumnSet ( string $type ) : boolean
$type string the grid column type (one of 'serial', 'action', 'checkbox').
Результат boolean whether the column is set.

registerAssets() защищенный Метод

Registers the TabularForm widget assets.
protected registerAssets ( )

renderGrid() защищенный Метод

Render the grid content.
protected renderGrid ( ) : string
Результат string the rendered gridview

run() публичный Метод

public run ( )

slash() защищенный статический Метод

Prepends with a back slash if necessary for full namespace validation.
protected static slash ( string $str = '' ) : string
$str string the input string
Результат string the modified namespace

Описание свойств

$_columns защищенное свойство

the grid columns
protected $_columns

$actionColumn публичное свойство

the settings for the action column. If set to false, the action column will not be displayed.
public $actionColumn

$checkboxColumn публичное свойство

the settings for the checkbox column. If set to false, the checkbox column will not be displayed.
public $checkboxColumn

$compositeKeySeparator публичное свойство

the separator for the composite keys available as an array.
public $compositeKeySeparator

$dataProvider публичное свойство

the data provider for the tabular form. This property is required. It must return a valid list of models for rendering the tabular form inputs.
public $dataProvider

$gridClass публичное свойство

the namespaced GridView class name. Defaults to '\kartik\grid\GridView'. Any other class set here must extend from '\kartik\grid\GridView'.
public $gridClass

$gridSettings публичное свойство

the settings for [[GridView]] widget which will display the tabular form content.
public $gridSettings

$rowHighlight публичное свойство

highlight current row if checkbox is checked.
public $rowHighlight

$rowSelectedClass публичное свойство

the CSS class to apply to a row when the row is selected.
public $rowSelectedClass

$serialColumn публичное свойство

the settings for the serial column. If set to false, the serial column will not be displayed.
public $serialColumn