Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand parent nodes of selected item. Scroll menu to selected item. #310

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

varlamov88
Copy link

@varlamov88 varlamov88 commented Nov 7, 2019

If i have multilevel tree and v-model has an initial value (for example, from db), that lies deep on the tree, i cant see selected value, when open "treeselect". defaultExpandLevel open all nodes, its not suitable.
lastScrollPosition doesnt work, when i open page first time. It has srollTop = 0. And i want open menu with selected item located in the center, not with "saveMenuScrollPosition" from the last time.

Second commit is about expand parents in search mode then children id selected.
I have this state (on screenshot). Then I input "AB" to the search area, tree expanded and I select "AB" item, then tree is collapsed and selected item is not visible. P.S. I dont need expand all levels by default.
Screenshot_1

@gulbaek
Copy link

gulbaek commented Jan 21, 2020

Is there anything new about this feature and a possible release date?

@emacle
Copy link

emacle commented Jul 3, 2020

nice PR!!! Thank you for the fix @varlamov88!

I tested this.expandParentNodes() should be in openMenu() like the follow:

     if (this.scrollPositionOnCenter) {
       // if in initialize(), when second open menu cannot scroll menu 
       // because $option = document.querySelector(".vue-treeselect__option--selected");
       // will not initial then null
       this.expandParentNodes();  
       this.$nextTick(this.scrollMenuOnCenter);
      }

emacle added a commit to emacle/vue-treeselect that referenced this pull request Jul 3, 2020
   @varlamov88 [Expand parent nodes of selected item. Scroll menu to selected item](riophae#310)

   使用选项: scrollPositionOnCenter = true

```
   <treeselect
            v-model="orgCode"
            :clearable="true"
            :scrollPositionOnCenter="true"
            :default-expand-level="0"
          />
```
emacle added a commit to emacle/vue-treeselect that referenced this pull request Jul 3, 2020
   @varlamov88 [Expand parent nodes of selected item. Scroll menu to selected item](riophae#310)

   使用选项: scrollPositionOnCenter = true

```
   <treeselect
            v-model="orgCode"
            :clearable="true"
            :scrollPositionOnCenter="true"
            :default-expand-level="0"
          />
```
emacle added a commit to emacle/vue-treeselect that referenced this pull request Jul 12, 2020
   @varlamov88 [Expand parent nodes of selected item. Scroll menu to selected item](riophae#310)

   使用选项: scrollPositionOnCenter = true

```
   <treeselect
            v-model="orgCode"
            :clearable="true"
            :scrollPositionOnCenter="true"
            :default-expand-level="0"
          />
```
emacle added a commit to emacle/vue-treeselect that referenced this pull request Jul 12, 2020
   @varlamov88 [Expand parent nodes of selected item. Scroll menu to selected item](riophae#310)

   使用选项: scrollPositionOnCenter = true

```
   <treeselect
            v-model="orgCode"
            :clearable="true"
            :scrollPositionOnCenter="true"
            :default-expand-level="0"
          />
```
@lenqwang
Copy link

Have any question on this PR?

I also have this question need this PR, so whether consider to merge this right now if have no question else?

almas added a commit to dusal/vue-treeselect that referenced this pull request Aug 8, 2021
Scroll menu to selected item, by center. Pull request by varlamov88.
@felipyamorim
Copy link

any news about merge this pr ?

emacle added a commit to emacle/vue-treeselect that referenced this pull request Jan 18, 2023
   @varlamov88 [Expand parent nodes of selected item. Scroll menu to selected item](riophae#310)

   使用选项: scrollPositionOnCenter = true

```
   <treeselect
            v-model="orgCode"
            :clearable="true"
            :scrollPositionOnCenter="true"
            :default-expand-level="0"
          />
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants