Class kartik\tree\TreeViewInput

Inheritancekartik\tree\TreeViewInput » kartik\tree\TreeView » kartik\base\Widget » yii\base\Widget » yii\base\Component » yii\base\BaseObject
Implementskartik\base\BootstrapInterface, yii\base\Configurable, yii\base\ViewContextInterface
Uses Traitskartik\base\BootstrapTrait, kartik\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. This widget should be used, if you wish the user to select items from a list displayed in a tree structure.

For example,

use kartik\tree\TreeViewInput;
echo TreeViewInput::widget([
    // single query fetch to render the tree
    'query'             => Tree::find()->addOrderBy('root, lft'),
    'headingOptions'    => ['label' => 'Categories'],
    'name'              => 'kv-product',    // input name
    'value'             => '1,2,3',         // values selected (comma separated for multiple select)
    'asDropdown'        => true,            // will render the tree input widget as a dropdown.
    'multiple'          => true,            // set to false if you do not need multiple selection
    'fontAwesome'       => true,            // render font awesome icons
    'rootOptions'       => [
        'label' => '<i class="fas fa-tree"></i>',
        'class' => 'text-success'
    ],                                      // custom root label
    //'options'         => ['disabled' => true],
]);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$alertFadeDuration integer Animation duration (ms) for fading in and out alerts that are displayed during manipulation of nodes. kartik\tree\TreeView
$allowNewRoots boolean Allow new root creation. kartik\tree\TreeView
$asDropdown boolean 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
$autoCloseOnSelect boolean Whether to autoclose the dropdown on input selection when asDropdown is true. kartik\tree\TreeViewInput
$autoIdPrefix string The prefix to the automatically generated widget IDs. yii\base\Widget
$autoLoadBsPlugin boolean Whether to auto load the bootstrap plugin assets if showTooltips is true OR if TreeViewInput::asDropdown is true. kartik\tree\TreeView
$baseSourcePath string|false Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. kartik\base\WidgetTrait
$behaviors yii\base\Behavior[] List of behaviors attached to this component. yii\base\Component
$breadcrumbs array The breadcrumbs settings for displaying the current node title based on parent hierarchy in the node details form/view (starting from the current node). kartik\tree\TreeView
$bsColCssPrefixes array The bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. kartik\base\BootstrapTrait
$bsCssMap array CSS conversion mappings across bootstrap library versions. kartik\base\BootstrapTrait
$bsExtBasename integer The yii2 bootstrap extension base name (readonly property available via getter method getBsExtBasename()) kartik\base\BootstrapTrait
$bsVer integer Bootstrap version number currently set (readonly property available via getter method getBsVer()) kartik\base\BootstrapTrait
$bsVersion integer|string The bootstrap library version that you wish to use for this specific extension / widget. kartik\base\BootstrapTrait
$buttonGroupOptions array The HTML attributes for the button groups within the toolbar. kartik\tree\TreeView
$buttonIconOptions array The default HTML attributes for the toolbar button icons kartik\tree\TreeView
$buttonOptions array 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
$cascadeSelectChildren boolean Whether to auto select all children when a parent node is selected. kartik\tree\TreeView
$checkedNodeOptions array 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 array The HTML attributes for the indicator for collapsing a node. kartik\tree\TreeView
$counter integer A counter used to generate $id for widgets. yii\base\Widget
$defaultBtnCss string Default bootstrap button CSS (readonly property available via getter method getDefaultBtnCss()) kartik\base\BootstrapTrait
$defaultCheckedNodeIcon array Default icon for a checked node which will represent a checked checkbox. kartik\tree\TreeView
$defaultChildNodeIcon string The icon markup for the child node if no icon was setup in the database. kartik\tree\TreeView
$defaultCollapseNodeIcon string The default icon for collapsing the node. kartik\tree\TreeView
$defaultExpandNodeIcon string The default icon for expanding the node. kartik\tree\TreeView
$defaultIconPrefix string Default icon prefix (readonly property available via getter method getDefaultIconPrefix()) kartik\base\BootstrapTrait
$defaultOptions array Default HTML attributes or other settings for widgets. kartik\base\WidgetTrait
$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
$defaultPluginOptions array Default plugin options for the widget kartik\base\WidgetTrait
$defaultUncheckedNodeIcon string The HTML attributes for an unchecked node which will represent an unchecked checkbox. 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 integer The initial value (key) to be selected in the tree and displayed in the detail form. kartik\tree\TreeView
$dropdownClass string Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) kartik\base\BootstrapTrait
$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 array The HTML attributes for the indicator for expanding a node. kartik\tree\TreeView
$fontAwesome boolean 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
$hashVarLoadPosition integer The position where the client JS hash variables for the input widget will be loaded. kartik\base\WidgetTrait
$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 array The HTML attributes for the heading. kartik\tree\TreeView
$hideCssClass string The CSS class to hide HTML elements on the page. kartik\tree\TreeView
$hideTopRoot boolean Whether to hide the topmost root node container kartik\tree\TreeView
$hideUnmatchedSearchItems boolean Whether to hide unmatched search items when searching kartik\tree\TreeView
$i18n array The the internalization configuration for this widget. kartik\base\TranslationTrait
$iconEditSettings array Settings to edit the icon. kartik\tree\TreeView
$iconPrefix string The icon prefix kartik\tree\TreeView
$id string|null ID of the widget. Note that the type of this property differs in getter and setter. See getId() and setId() for details. yii\base\Widget
$input string kartik\tree\TreeViewInput
$isAdmin boolean Whether the tree is to be allowed for editing in admin mode. kartik\tree\TreeView
$krajeeDialogSettings array Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts kartik\tree\TreeView
$mainTemplate string The main template for rendering the tree view navigation widget and the node detail view form. kartik\tree\TreeView
$model kartik\tree\models\Tree|yii\base\Model The tree data model that this widget is associated with. kartik\tree\TreeViewInput
$moduleId string The module identifier if this widget is part of a module. kartik\base\WidgetTrait
$multiple boolean Whether to allow selection of multiple nodes via 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
$nodeLabel array|Closure The value to customize a tree node's label. kartik\tree\TreeView
$nodeTitle string The title label to display for the tree node in the validation client messages. kartik\tree\TreeView
$nodeTitlePlural string The title label to display for plural tree nodes in the validation client messages. 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
$nodeViewButtonLabels array The markup for the submit and reset button labels in the node view form kartik\tree\TreeView
$nodeViewParams array Any additional parameters to be sent or any parameters to override within the $nodeView. kartik\tree\TreeView
$options array The HTML attributes for the input that will store the selected nodes for the widget kartik\tree\TreeView
$parentNodeIconOptions array The HTML attributes for the parent node icon. kartik\tree\TreeView
$pjaxContainerId string The identifier for the PJAX widget container if the widget is to be rendered inside a PJAX container. kartik\base\WidgetTrait
$pjaxDuplicationFix boolean Prevent duplication of pjax containers when browser back & forward buttons are pressed. kartik\base\WidgetTrait
$pluginDestroyJs string The javascript that will be used to destroy the jQuery plugin kartik\base\WidgetTrait
$pluginEvents array Widget JQuery events. kartik\base\WidgetTrait
$pluginName string The plugin name kartik\base\WidgetTrait
$pluginOptions array Widget plugin options. kartik\base\WidgetTrait
$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 array The HTML attributes for the search clear indicator kartik\tree\TreeView
$searchContainerOptions array The HTML attributes for the search container kartik\tree\TreeView
$searchOptions array The HTML attributes for the search input kartik\tree\TreeView
$showCheckbox boolean Whether to show a checkbox before each tree node label to allow multiple node selection. kartik\tree\TreeView
$showFormButtons boolean Whether to show the form action buttons in the node details form/view. kartik\tree\TreeView
$showIDAttribute boolean Whether to show the key attribute (ID) in the node details form/view. kartik\tree\TreeView
$showInactive boolean Whether to show inactive nodes kartik\tree\TreeView
$showNameAttribute boolean Whether to show the name attribute (name) in the node details form/view. kartik\tree\TreeView
$showToolbar boolean Whether to show the toolbar in the footer. kartik\tree\TreeViewInput
$showTooltips boolean Show toolbar button tooltips (using bootstrap tooltip plugin). kartik\tree\TreeView
$softDelete boolean Whether the record will be soft deleted, when remove button is clicked. kartik\tree\TreeView
$sourcePath string Directory path to the original widget source. kartik\base\WidgetTrait
$stack yii\base\Widget[] The widgets that are currently being rendered (not ended). yii\base\Widget
$toolbar array The settings for the tree management toolbar kartik\tree\TreeView
$toolbarOptions array The HTML attributes for the toolbar. kartik\tree\TreeView
$toolbarOrder array The sorting order of the buttons in the toolbar. kartik\tree\TreeView
$topRootAsHeading boolean Whether to show topmost root node as heading. kartik\tree\TreeView
$treeOptions array The HTML attributes for the tree selector container kartik\tree\TreeView
$treeWrapperOptions array The HTML attributes for the wrapper container for the tree header, body, and footer. kartik\tree\TreeView
$uncheckedNodeOptions array The HTML attributes for the indicator which will represent an unchecked checkbox. kartik\tree\TreeView
$value string The input value. kartik\tree\TreeViewInput
$view yii\web\View The view object that can be used to render views or view files. Note that the type of this property differs in getter and setter. See getView() and setView() for details. yii\base\Widget
$viewPath string The directory containing the view files for this widget. yii\base\Widget
$wrapperTemplate string The wrapper template for rendering the tree view navigation widget. kartik\tree\TreeView

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_bsVer integer Current bootstrap version number kartik\base\BootstrapTrait
$_dataVar string The HTML5 data variable name that will be used to store the Json encoded pluginOptions within the element on which the jQuery plugin will be initialized. kartik\base\WidgetTrait
$_defaultBtnCss string Default bootstrap button CSS kartik\base\BootstrapTrait
$_defaultCaret string Default caret markup rendered for the dropdown toggle kartik\tree\TreeViewInput
$_defaultIconPrefix string Default icon CSS prefix kartik\base\BootstrapTrait
$_encOptions string The JSON encoded plugin options. kartik\base\WidgetTrait
$_hasBootstrap boolean Whether to load the bootstrap plugin asset kartik\tree\TreeView
$_hashVar string The generated hashed variable name that will store the JSON encoded pluginOptions in yii\web\View::POS_HEAD. kartik\base\WidgetTrait
$_iconsListShow string The icons list show type set under iconEditSettings kartik\tree\TreeView
$_isBs4 boolean Flag to detect whether bootstrap 4. kartik\base\BootstrapTrait
$_module kartik\tree\Module The tree management module. kartik\tree\TreeView
$_msgCat string Translation message file category name for i18n. kartik\base\TranslationTrait
$_nodeIcons array Configuration of icons for Glyphicons and Font Awesome. kartik\tree\TreeView
$_nodeIconsList mixed The icons list kartik\tree\TreeView
$_nodeSelected string Session identifier for the selected node id kartik\tree\TreeView
$_nodes array The queried tree nodes kartik\tree\TreeView

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
addCssClass() Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type. kartik\base\BootstrapTrait
afterRun() This method is invoked right after a widget is executed. yii\base\Widget
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
beforeRun() This method is invoked right before the widget is executed. yii\base\Widget
begin() Begins a widget. kartik\tree\TreeView
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\BaseObject
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
end() Ends a widget. yii\base\Widget
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBSClass() Gets the respective Bootstrap class based on currently configured bootstrap version. kartik\base\BootstrapTrait
getBaseSourcePath() Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. kartik\base\WidgetTrait
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getBsVer() Gets the current set bootstrap version number. kartik\base\BootstrapTrait
getConfig() Generates the configuration for the widget based on module level defaults kartik\tree\TreeView
getCssClass() Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type. kartik\base\BootstrapTrait
getDefaultBtnCss() Gets the default button CSS kartik\base\BootstrapTrait
getDefaultIconPrefix() Gets the default icon css prefix kartik\base\BootstrapTrait
getDropdownClass() Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. kartik\base\BootstrapTrait
getId() Returns the ID of the widget. yii\base\Widget
getInput() Generates the hidden input for storage kartik\tree\TreeViewInput
getView() kartik\base\WidgetTrait
getViewPath() Returns the directory containing the view files for this widget. yii\base\Widget
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. kartik\tree\TreeView
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait
initOptions() Initialize all options & settings for the widget kartik\tree\TreeView
isBs() Validate Bootstrap version kartik\base\BootstrapTrait
isBs4() Validate if Bootstrap 4.x version. kartik\base\BootstrapTrait
module() Returns the tree view module kartik\tree\TreeView
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
registerAssets() Registers the client assets for the widget kartik\tree\TreeView
registerInputAssets() Registers assets for TreeViewInput kartik\tree\TreeViewInput
registerWidgetJs() Registers a JS code block for the widget. kartik\base\WidgetTrait
removeCssClass() Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type. kartik\base\BootstrapTrait
render() Renders a view. yii\base\Widget
renderDetail() Renders the markup for the detail form to edit/view the selected tree node kartik\tree\TreeView
renderFile() Renders a view file. yii\base\Widget
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() Executes the widget. kartik\tree\TreeViewInput
setId() Sets the ID of the widget. yii\base\Widget
setView() Sets the view object to be used by this widget. yii\base\Widget
trigger() Triggers an event. yii\base\Component
widget() Creates a widget instance and runs it. kartik\tree\TreeView

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
addAsset() Adds an asset to the view. kartik\base\WidgetTrait
configureBsVersion() Configures the bootstrap version settings kartik\base\BootstrapTrait
fixPjaxDuplication() Fix for weird PJAX container duplication behavior on pressing browser back and forward buttons. kartik\base\WidgetTrait
getBsExtBasename() The yii2-bootstrap extension base name. kartik\base\BootstrapTrait
getIconsList() Renders the markup for the detail form to edit/view the selected tree node kartik\tree\TreeView
getPluginScript() Returns the plugin registration script. kartik\base\WidgetTrait
hasModel() kartik\tree\TreeViewInput
hashPluginOptions() Generates a hashed variable to store the pluginOptions. kartik\base\WidgetTrait
initBsVersion() Initializes bootstrap versions for the widgets and asset bundles. kartik\base\BootstrapTrait
initDestroyJs() Generates the pluginDestroyJs script if it is not set. kartik\base\WidgetTrait
initDropdown() Initialize tree dropdown menu settings and options kartik\tree\TreeViewInput
initIcons() Initialize icons kartik\tree\TreeView
initSelectedNode() Initializes the selected node kartik\tree\TreeView
initTreeView() Initializes and validates the tree view configurations kartik\tree\TreeViewInput
isSameVersion() Compares two versions and checks if they are of the same major BS version. kartik\base\BootstrapTrait
mergeDefaultOptions() Merge default options kartik\base\WidgetTrait
parseBool() Parses a boolean variable and returns as integer kartik\tree\TreeView
parseVer() Parses and returns the major BS version kartik\base\BootstrapTrait
registerPlugin() Registers a specific plugin and the related events kartik\base\WidgetTrait
registerPluginOptions() Registers plugin options by storing within a uniquely generated 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 a HTML5 data variable. kartik\base\WidgetTrait
sortToolbar() Sorts the toolbar based on toolbarOrder configuration kartik\tree\TreeView
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

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_RUN yii\base\WidgetEvent An event raised right after executing a widget. (available since version 2.0.11) yii\base\Widget
EVENT_BEFORE_RUN yii\base\WidgetEvent An event raised right before executing a widget. (available since version 2.0.11) yii\base\Widget
EVENT_INIT yii\base\Event An event that is triggered when the widget is initialized via init(). (available since version 2.0.11) yii\base\Widget

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
BTN_CREATE 'create' Create tree node button kartik\tree\TreeView
BTN_CREATE_ROOT 'create-root' Create root tree node button kartik\tree\TreeView
BTN_MOVE_DOWN 'move-down' Move tree node down button kartik\tree\TreeView
BTN_MOVE_LEFT 'move-left' Move tree node left button kartik\tree\TreeView
BTN_MOVE_RIGHT 'move-right' Move tree node right button kartik\tree\TreeView
BTN_MOVE_UP 'move-up' Move tree node up button kartik\tree\TreeView
BTN_REFRESH 'refresh' Tree refresh button kartik\tree\TreeView
BTN_REMOVE 'remove' Remove tree node button kartik\tree\TreeView
BTN_SEPARATOR 'separator' Button separator kartik\tree\TreeView
ICON_CSS 1 CSS class based icon kartik\tree\TreeView
ICON_RAW 2 Raw HTML markup based icon kartik\tree\TreeView
MOVE_DOWN 'd' Direction for moving selected node DOWN one level in the tree kartik\tree\TreeView
MOVE_LEFT 'l' Direction for moving selected node LEFT one level in the tree kartik\tree\TreeView
MOVE_RIGHT 'r' Direction for moving selected node RIGHT one level in the tree kartik\tree\TreeView
MOVE_UP 'u' Direction for moving selected node UP one level in the tree kartik\tree\TreeView
ROOT_KEY 'KRAJEE~!~ROOT~!~NODE' Value for root node key kartik\tree\TreeView

Property Details

$_defaultCaret protected property

Default caret markup rendered for the dropdown toggle

protected string $_defaultCaret null
$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. Defaults to true. The BootstrapPluginAsset will automatically be loaded if this is set to true. Defaults to true.

public boolean $asDropdown true
$attribute public property

The model attribute that this widget is associated with.

public string $attribute null
$autoCloseOnSelect public property

Whether to autoclose the dropdown on input selection when asDropdown is true. Defaults to true.

$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 $_defaultCaret.
public array $dropdownConfig = []
$input public read-only property
public string getInput ( )
$model public property

The tree data model that this widget is associated with.

$name public property

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

public string $name null
$showToolbar public property

Whether to show the toolbar in the footer. Defaults to false.

public boolean $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.

initDropdown() protected method

Initialize tree dropdown menu settings and options

protected void initDropdown ( )
initTreeView() protected method

Initializes and validates the tree view configurations

protected void initTreeView ( )
throws yii\base\InvalidConfigException
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 ( )
throws Exception
renderWidget() public method

Renders the widget markup

public string renderWidget ( )
throws yii\base\InvalidConfigException
run() public method

Executes the widget.

public string|void run ( )
return string|void

The rendering result may be directly "echoed" or returned as a string

throws yii\base\InvalidConfigException