chniter / bstreeview

Bootstrap Treeview, A very simple plugin to build a basic and elegant Treeview with bootstrap 4. See the demo:
https://chniter.github.io/bstreeview/
Apache License 2.0
367 stars 53 forks source link

customize the name property of the data #18

Open foxmask opened 3 years ago

foxmask commented 3 years ago

Hi, in your example you give us a var containing

var tree = [
  {
    text: "Node 1",
    icon: "fa fa-folder",
    nodes: [
      {
        text: "Sub Node 1",
        icon: "fa fa-folder",
        nodes: [
          {
            id:    "sub-node-1",
            text:  "Sub Child Node 1",
            icon:  "fa fa-folder",
            class: "nav-level-3",
            href:  "https://google.com"
          },
          {
            text: "Sub Child Node 2",
            icon: "fa fa-folder"
          }
        ]
      },
      {
        text: "Sub Node 2",
         icon: "fa fa-folder"
      }
    ]
  },

What if my array is named children and my text is named title ?

I thought I could try

// Example: initializing the bstreeview
$('#tree').bstreeview({
  data: data,
  expandIcon: 'fa fa-angle-down fa-fw',
  collapseIcon: 'fa fa-angle-right fa-fw',
  indent: 1.25,
  parentsMarginLeft: '1.25rem',
  openNodeLinkOnNewTab: true
  nodes: 'children',
  text: 'title',
});

but that does not do the trick.

Is it possible ?

regards

chniter commented 3 years ago

Hi,

Stay tuned, will be done next release.