Class kartik\tree\TreeViewInput

Inheritancekartik\tree\TreeViewInput » kartik\tree\TreeView » kartik\base\Widget » yii\base\Widget
Uses Traitskartik\base\TranslationTrait, kartik\base\WidgetTrait
Available since version1.0

An input widget that extends kartik\tree\TreeView, and allows one to select records from the tree.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$alertFadeDuration int Animation duration (ms) for fading in and out alerts that are displayed during manipulation of nodes. kartik\tree\TreeView
$allowNewRoots bool Allow new root creation. kartik\tree\TreeView
$asDropdown bool Whether to show the input as a dropdown select. kartik\tree\TreeViewInput
$attribute string The model attribute that this widget is associated with. kartik\tree\TreeViewInput
$buttonGroupOptions array The HTML attributes for the button groups within the toolbar. kartik\tree\TreeView
$buttonIconOptions string The default HTML attributes for the toolbar button icons kartik\tree\TreeView
$buttonOptions string The default HTML attributes for the toolbar buttons kartik\tree\TreeView
$cacheSettings array Cache settings for displaying the detail form content for each tree node via ajax. kartik\tree\TreeView
$checkedNodeOptions string The HTML attributes for the indicator which will represent a checked checkbox. kartik\tree\TreeView
$childNodeIconOptions array The HTML attributes for the child node icon. kartik\tree\TreeView
$clientMessages array The configuration of various client alert messages kartik\tree\TreeView
$collapseNodeOptions string The HTML attributes for the indicator for collapsing a node. kartik\tree\TreeView
$defaultChildNodeIcon string The icon markup for the child node if no icon was setup in the database. kartik\tree\TreeView
$defaultParentNodeIcon string The icon markup for the collapsed parent node if no icon was setup in the database. kartik\tree\TreeView
$defaultParentNodeOpenIcon string The icon markup for the opened parent node if no icon was setup in the database. kartik\tree\TreeView
$detailOptions array The HTML attributes for the detail form container which will display the details of the selected node kartik\tree\TreeView
$displayValue int The initial value (key) to be selected in the tree and displayed in the detail form. kartik\tree\TreeView
$dropdownConfig array The configuration of the tree view dropdown. kartik\tree\TreeViewInput
$emptyNodeMsg string Message shown on tree initialization when either the entire tree is empty or no node is found for the selected displayValue. kartik\tree\TreeView
$emptyNodeMsgOptions array HTML attributes for the empty node message displayed. kartik\tree\TreeView
$expandNodeOptions string The HTML attributes for the indicator for expanding a node. kartik\tree\TreeView
$fontAwesome bool Whether to use font awesome icons. kartik\tree\TreeView
$footerOptions array The HTML attributes for the tree footer container. kartik\tree\TreeView
$footerTemplate string The template for rendering the footer kartik\tree\TreeView
$headerOptions array The HTML attributes for the tree header container kartik\tree\TreeView
$headerTemplate string The template for rendering the header kartik\tree\TreeView
$headingOptions string The HTML attributes for the heading. kartik\tree\TreeView
$i18n array The the internalization configuration for this widget kartik\base\Widget
$iconEditSettings array Settings to edit the icon. kartik\tree\TreeView
$isAdmin bool Whether the tree is to be allowed for editing in admin mode. kartik\tree\TreeView
$mainTemplate \kartik\tree\the Main template for rendering the tree view navigation widget and the node detail view form. kartik\tree\TreeView
$model \yii\base\Model The data model that this widget is associated with. kartik\tree\TreeViewInput
$multiple bool Whether to allow multiple selection of checkboxes. kartik\tree\TreeView
$name string The input name. kartik\tree\TreeViewInput
$nodeActions array The actions for managing, deleting, and moving the tree nodes. kartik\tree\TreeView
$nodeAddlViews array The list of additional view files that will be used to append content at various sections in the nodeView form. kartik\tree\TreeView
$nodeCheckboxOptions array The HTML attributes for the node checkbox indicator for all items in the tree kartik\tree\TreeView
$nodeFormOptions array The HTML attributes for the node detail form. kartik\tree\TreeView
$nodeToggleOptions array The HTML attributes for the node toggle indicator for each parent item in the tree kartik\tree\TreeView
$nodeView string The view file that will render the form for editing the node. kartik\tree\TreeView
$options array The HTML attributes for the input that will store the selected nodes for the widget kartik\tree\TreeViewInput
$parentNodeIconOptions array The HTML attributes for the parent node icon. kartik\tree\TreeView
$pluginEvents array Widget JQuery events. kartik\base\Widget
$pluginOptions array Widget plugin options kartik\base\Widget
$query \yii\db\ActiveQuery The query that will be used as the data source for the TreeView. kartik\tree\TreeView
$rootNodeCheckboxOptions array The HTML attributes for the root node's checkbox indicator kartik\tree\TreeView
$rootNodeToggleOptions array The HTML attributes for the root node's toggle indicator kartik\tree\TreeView
$rootOptions array The HTML attributes for the topmost root node container. kartik\tree\TreeView
$searchClearOptions string The HTML attributes for the search clear indicator kartik\tree\TreeView
$searchContainerOptions string The HTML attributes for the search container kartik\tree\TreeView
$searchOptions string The HTML attributes for the search input kartik\tree\TreeView
$showCheckbox bool Whether to show a checkbox before each tree node label to allow multiple node selection. kartik\tree\TreeView
$showFormButtons bool Whether to show the form action buttons in the node details form/view. kartik\tree\TreeView
$showIDAttribute bool Whether to show the key attribute (ID) in the node details form/view. kartik\tree\TreeView
$showInactive bool Whether to show inactive nodes kartik\tree\TreeView
$showToolbar bool Whether to show the toolbar in the footer kartik\tree\TreeViewInput
$showTooltips bool Show toolbar button tooltips (using bootstrap tooltip plugin) kartik\tree\TreeView
$softDelete bool Whether the record will be soft deleted, when remove button is clicked. kartik\tree\TreeView
$toolbar array The settings for the tree management toolbar kartik\tree\TreeView
$toolbarOptions array The HTML attributes for the toolbar. kartik\tree\TreeView
$treeOptions array The HTML attributes for the tree selector container kartik\tree\TreeView
$treeWrapperOptions string The HTML attributes for the wrapper container for the tree header, body, and footer. kartik\tree\TreeView
$uncheckedNodeOptions string The HTML attributes for the indicator which will represent an unchecked checkbox. kartik\tree\TreeView
$value string The input value. kartik\tree\TreeViewInput
$wrapperTemplate \kartik\tree\the Wrapper template for rendering the tree view navigation widget kartik\tree\TreeView

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_dataVar string The element's HTML5 data variable name storing the pluginOptions kartik\base\Widget
$_encOptions string The Json encoded options kartik\base\Widget
$_hashVar string The hashed global variable name storing the pluginOptions kartik\base\Widget
$_iconPrefix string The icon prefix kartik\tree\TreeView
$_iconsList mixed The icons list kartik\tree\TreeView
$_module kartik\tree\Module The tree management module. kartik\tree\TreeView
$_msgCat string Translation message file category name for i18n kartik\base\Widget
$_nodes array The queried tree nodes kartik\tree\TreeView
$_pluginName string The name of the jQuery plugin kartik\base\Widget

Public Methods

Hide inherited methods

MethodDescriptionDefined By
begin() kartik\tree\TreeView
getConfig() Generates the configuration for the widget based on module level defaults kartik\tree\TreeView
getInput() Generates the hidden input for storage kartik\tree\TreeViewInput
init() kartik\tree\TreeViewInput
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait
initOptions() Initialize all options & settings for the widget kartik\tree\TreeView
module() Returns the tree view module kartik\tree\TreeView
registerAssets() Registers the client assets for the widget kartik\tree\TreeView
registerInputAssets() Registers assets for TreeViewInput kartik\tree\TreeViewInput
renderDetail() Renders the markup for the detail form to edit/view the selected tree node kartik\tree\TreeView
renderFooter() Renders the markup for the tree footer container kartik\tree\TreeView
renderHeader() Renders the markup for the tree header container kartik\tree\TreeView
renderHeading() Renders the markup for the tree heading kartik\tree\TreeView
renderRoot() Renders the root markup for the tree kartik\tree\TreeView
renderSearch() Renders the markup for the search input kartik\tree\TreeView
renderToolbar() Renders the markup for the button actions toolbar kartik\tree\TreeViewInput
renderTree() Renders the markup for the tree hierarchy - uses a fast non-recursive mode of tree traversal. kartik\tree\TreeView
renderWidget() Renders the widget markup kartik\tree\TreeViewInput
renderWrapper() Renders the tree wrapper container kartik\tree\TreeView
run() kartik\tree\TreeViewInput
widget() kartik\tree\TreeView

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
addAsset() Adds an asset to the view kartik\base\WidgetTrait
getCheckboxIcon() Gets the checkbox icon based on fontAwesome setting kartik\tree\TreeView
getIconsList() Renders the markup for the detail form to edit/view the selected tree node kartik\tree\TreeView
getNodeIcon() Gets the default node icon markup kartik\tree\TreeView
getPluginScript() Returns the plugin registration script kartik\base\WidgetTrait
getToggleIcon() Gets the default toggle icon based on fontAwesome setting kartik\tree\TreeView
hasModel() kartik\tree\TreeViewInput
hashPluginOptions() Generates a hashed variable to store the pluginOptions. The following special data attributes will also be setup for the input widget, that can be accessed through javascript : - 'data-krajee-{name}' will store the hashed variable storing the plugin options. The {name} tag will represent the plugin name (e.g. select2, typeahead etc.) - Fixes issue #6. kartik\base\WidgetTrait
initDropdown() Initialize tree dropdown menu settings and options kartik\tree\TreeViewInput
initSelectedNode() Initializes the selected node kartik\tree\TreeView
registerPlugin() Registers a specific plugin and the related events kartik\base\WidgetTrait
registerPluginOptions() Registers plugin options by storing it in a hashed javascript variable kartik\base\WidgetTrait
renderCheckboxIcon() Renders the checkbox icon markup based on fontAwesome setting kartik\tree\TreeView
renderCheckboxIconContainer() Renders the checkbox icon container kartik\tree\TreeView
renderDropdown() Generates the dropdown tree menu kartik\tree\TreeViewInput
renderIcon() Renders a generic icon using icon suffix kartik\tree\TreeView
renderNodeIcon() Render the default node icon markup kartik\tree\TreeView
renderToggleIcon() Renders the default toggle icon markup based on fontAwesome setting kartik\tree\TreeView
renderToggleIconContainer() Renders the toggle icon container kartik\tree\TreeView
setDataVar() Sets HTML5 data variable kartik\base\WidgetTrait
usesTrait() Check if the trait is used by a specific class or recursively by any of the parent classes or parent traits kartik\tree\TreeView
validateSourceData() Validation of source query data kartik\tree\TreeView

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
BTN_CREATE 'create' kartik\tree\TreeView
BTN_CREATE_ROOT 'create-root' Toolbar buttons kartik\tree\TreeView
BTN_MOVE_DOWN 'move-down' kartik\tree\TreeView
BTN_MOVE_LEFT 'move-left' kartik\tree\TreeView
BTN_MOVE_RIGHT 'move-right' kartik\tree\TreeView
BTN_MOVE_UP 'move-up' kartik\tree\TreeView
BTN_REFRESH 'refresh' kartik\tree\TreeView
BTN_REMOVE 'remove' kartik\tree\TreeView
BTN_SEPARATOR 'separator' kartik\tree\TreeView
CARET '
'
Caret rendered for the dropdown toggle kartik\tree\TreeViewInput
ICON_CSS 1 The icon types for each node stored in database kartik\tree\TreeView
ICON_RAW 2 kartik\tree\TreeView
MOVE_DOWN 'd' kartik\tree\TreeView
MOVE_LEFT 'l' kartik\tree\TreeView
MOVE_RIGHT 'r' kartik\tree\TreeView
MOVE_UP 'u' The node reorder/movable directions kartik\tree\TreeView

Property Details

$asDropdown public property

Whether to show the input as a dropdown select. If set to false, it will display directly the tree view selector widget.

public bool $asDropdown true
$attribute public property

The model attribute that this widget is associated with.

public string $attribute null
$dropdownConfig public property

The configuration of the tree view dropdown. The following configuration options are available:

  • input: array the HTML attributes for the dropdown input container which displays the selected tree items. The following special options are available:
    • placeholder: string, defaults to Select...
  • dropdown: array, the HTML attributes for the dropdown tree view menu.
  • options: array, the HTML attributes for the wrapper container
  • caret: string, the markup for rendering the dropdown indicator for up and down. Defaults to TreeViewInput::CARET.
public array $dropdownConfig = []
$model public property

The data model that this widget is associated with.

public \yii\base\Model $model null
$name public property

The input name. This must be set if $model and $attribute are not set.

public string $name null
$options public property

The HTML attributes for the input that will store the selected nodes for the widget

public array $options = ['class' => 'form-control hide']
$showToolbar public property

Whether to show the toolbar in the footer

public bool $showToolbar false
$value public property

The input value.

public string $value null

Method Details

getInput() public method

Generates the hidden input for storage

public string getInput ( )
hasModel() protected method

protected boolean hasModel ( )
return boolean

Whether this widget is associated with a data model.

init() public method

public void init ( )
initDropdown() protected method

Initialize tree dropdown menu settings and options

protected void initDropdown ( )
registerInputAssets() public method

Registers assets for TreeViewInput

public void registerInputAssets ( )
renderDropdown() protected method

Generates the dropdown tree menu

protected string renderDropdown ( $content )
$content string

The content to be embedded in the dropdown menu

renderToolbar() public method

Renders the markup for the button actions toolbar

public string renderToolbar ( )
renderWidget() public method

Renders the widget markup

public string renderWidget ( )
run() public method

public void run ( )