0

I used kartik\tree\TreeViewInput in my project but in update form I can't display current selected values in treeview input!

I tried some thing like this based on documentation:

<?=  $form->field($model, 'tags')->widget(\kartik\tree\TreeViewInput::className(),[
                                                    'name' => 'tags',
                                                    'query' => Tags::find()->addOrderBy('root, lft'),
                                                    'value' => 1,
                                                    'headingOptions' => ['label' => 'tags'],
                                                    'rootOptions' => ['label'=>'<i class="fa fa-building"></i>'],
                                                    'fontAwesome' => true,
                                                    'asDropdown' => true,
                                                    'multiple' => true,
                                                    'options' => ['disabled' => false]
                                                ]);   ?>

But it doesn't display tag with (id='1')! How should I display values?

amir zaghari
  • 89
  • 14

1 Answers1

0

Use:

 'displayValue' => 1,

to auto display a node with id = 1 on the form.

If you do not want any node to be auto displayed use:

'displayValue' => 0,
Miloud Eloumri
  • 779
  • 1
  • 8
  • 14
  • I have added a new [question](https://stackoverflow.com/questions/62632209/yii2-show-hide-kartik-treeview-nodes) related to treeview can you please see it? – Moeez Jun 29 '20 at 06:44