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

How to change a tree programmatically based on event #74

Open
alemicro opened this issue Feb 13, 2020 · 0 comments
Open

How to change a tree programmatically based on event #74

alemicro opened this issue Feb 13, 2020 · 0 comments

Comments

@alemicro
Copy link

Question:

I have two tree one with directory and one with the list of file and directory, in two separate boxes.

How can clicking on a directory of the first tree to see only the files on the second tree corresponding to the directory?

here my code

<div class="row" id="treeView">
        <div class="tree-container col-md-3">
            <sl-vue-tree
                    v-model="leftFrontTree"
                    ref="slVueTree"
            >


                <template slot="title" slot-scope="{ node }">
                    <span class="item-icon">
                        <i class="fa fa-folder" v-if="!node.isLeaf"></i>
                        <i class="fa fa-file-alt" v-if="node.isLeaf"></i>
                    </span>

                    {{ node.title }}
                </template>

                <template slot="toggle" slot-scope="{ node }">
                  <span v-if="!node.isLeaf">
                    <i v-if="node.isExpanded" class="fa fa-chevron-down"></i>
                    <i v-if="!node.isExpanded" class="fa fa-chevron-right"></i>
                  </span>
                </template>

                <template slot="sidebar" slot-scope="{ node }">
                  <span v-if="node.isLeaf" class="visible-icon" @click="event => listFiles(event, node)">
                    <i class="fa fa-eye"></i>
                  </span>
                </template>

            </sl-vue-tree>

        </div>

        <div id="fileListId" class="col-md-3">
            <sl-vue-tree
                    v-model="frontTreeFull"
                    ref="refFrontTreeFull"
            >
                <template slot="title" slot-scope="{ node }">
                    <span class="item-icon">
                        <i class="fa fa-file"></i>
                    </span>

                    {{ node.title }}
                </template>

                <template slot="sidebar" slot-scope="{ node }">
                    <span class="visible-icon" @click="event => preview(event, node)">
                        <i class="fa fa-eye"></i>
                    </span>
                    <span class="visible-icon" @click="event => download(event, node)">
                        <i class="fa fa-cloud-download-alt"></i>
                    </span>
                </template>
            </sl-vue-tree>
        </div>
        <div id="filePreview" class="col-md-3">
            <h3>qui va l'anteprima del pdf</h3>

        </div>
    </div>

the javascript method tha I want to call

listFiles: function (event, node) {
                        debugger
                        event.stopPropagation();
                       
                        this.$refs.refFrontTreeFull = this.$refs.refFrontTreeFull.getNode(node.path);
}

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

No branches or pull requests

1 participant