Forum Discussion
Trouble using the bootstrap-tree-view library in a project
In most of cases whan you need to do to use Bootstrap is to install via npm, find typings via npm and include all of required JS files into externalJS property of pbiviz.json and also import Bootstrap CSS as less in styles.less if stypes are required.
What exactly issues have you faced? It'd be nice if you can share your custom visual to check it from our side.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
It seems like there are no typings for the bootstrap package I was trying to use yesterday so I decided to look for an alternative way
I downloaded "npm-patternfly-bootstrap-treeview"and then got these typings npm i @types/bootstrap-treeview
In my update function is this line, which should display the tree, according to the "Getting started"
$('#tree').treeview({data: this.listToTree(filteredViewModel)})This is in my visual.less file
@import (less) "node_modules/bootstrap/dist/css/bootstrap.css"; @import (less) "node_modules/patternfly-bootstrap-treeview/dist/bootstrap-treeview.css";
tsconfig
"files": [
".api/v1.12.0/PowerBI-visuals.d.ts",
"node_modules/powerbi-visuals-utils-dataviewutils/lib/index.d.ts",
"src/settings.ts",
"src/visual.ts",
"node_modules/@types/d3/index.d.ts",
"node_modules/@types/bootstrap-treeview/index.d.ts"
]And this is my externalJS
"externalJS": [
"node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
"node_modules/d3/d3.min.js",
"node_modules/jquery/dist/jquery.js",
"node_modules/patternfly-bootstrap-treeview/dist/bootstrap-treeview.min.js",
I thought this was enough but when I refresh my visual I get this error message in the console
Uncaught TypeError: Cannot read property 'fn' of undefined
I'm not sure what is going on right now. I can give you more information if you need it, thought this would be enough for now.
Thanks in advance, I really need this to work
- v-viig8 years agoCommunity Champion
Power BI creates a copy of window object. Thios might cause issues with some libraries.
Could you please share source code of yourcustom visual to investigate this issue?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals