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
파일 보기 프로젝트 열기: kartik-v/yii2-builder 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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.

보호된 프로퍼티들

프로퍼티 타입 설명
$_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