How can I get current node and pass it as request parameter to display it child nodes using Quasar Tree lazy loading?

  • I am using Quasar Tree lazy loading to display the data like shown in image


    onclick of first node I am displaying child nodes from a local JSON file, now when i click on respective child node I want to display it sub childs from another JSON file by passing its parent node id.
    Here is my code

      <q-page class="flex fixed-left">
    <style >
    import someJson from "./static/somejson.json";
    import datasetsJson from "./static/datasetsjson.json";
    export default {
      name: "HelloWorld",
      data() {
        return {
          tree: [],
          selected: "",
          selectedObject: null,
          json: someJson,
          djson: datasetsJson,
          newObj: [],
          treeArr: [
              content: "Resources",
              children: [],
      computed: {},
      methods: {},
      created() {
        this.tree = this.get_leaves()
        console.log("json", someJson);
       Object.keys(this.json.body.projects.projects).forEach((j) => {
     var child = { id: j, content: this.json.body.projects.projects[j].friendlyName, children: [] };
    console.log("test", this.json.body.projects.projects[j]);
    console.log("childs", child);

    Can any one please tell me how can I get current node and pass it as request parameter to display its respective child nodes.

  • @user123 check the events and methods section of the qtree api. selected for example emits the key, use a ref on your qtree then use one of the method getNodeByKey to get the node object.

Log in to reply