Doctype TreeView in Dialog?

Hi there,

i need to show a Doctype TreeView in Dialog (i.e. Warehouse, Item Group), so that will be possible to select a group from tree?

Any hint?

Thx

were you able to find a way? Looking for the same.

I’m thinking of applying this https://github.com/vakata/jstree#populating-a-tree-using-an-array-or-json @JoEz

@johnskywalker sound nice …

@JoEz got it working

2 Likes

What is the use case?

Great … :clap::clap::clap:

Let’s say you want to show item group tree path in the item and not just it’s group

2 Likes

Yes this is correct. I’m using this now https://github.com/justinchmura/js-treeview

1 Like

use case : if you have scanners and OCRed your invoice then the data can appear in a tree format.

1 Like

@johnskywalker any chance to share the code?

1 Like

yes just add files under “dist” from this repo https://github.com/justinchmura/js-treeview and to the following directories:

/public/css
/public/js

edit your build.json and add the path of the files
OR your hooks.py should have like this:

app_include_css = “/assets/erpnext_ocr/css/treeview.min.css”
app_include_js = “/assets/erpnext_ocr/js/treeview.min.js”

and then

var tree = new TreeView([
{ name: ‘Item 1’, children: [] },
{ name: ‘Item 2’, expanded: true, children: [
{ name: ‘Sub Item 1’, children: [] },
{ name: ‘Sub Item 2’, children: [] }
]
}
], ‘tree’);

No need for the

var TreeView = require(‘js-treeview’);

1 Like