Showing 1 – 3 of 3 replies
sistemaontime

I am trying to include a treeview into […]

sistemaontime PURCHASED
5 years ago
Hello

I am trying to include a treeview into:

<!-- Page content-->
<section class="section-container">
<div class="container-fluid">

<div class="row">

<div class="col-xl-4 col-md-8">
<div class="cardbox">

<div class="cardbox-body text-center">
<p>The tree here</p>
</div>

<div id="treeview"></div>

</div>
</div>


</div>
</section>

---

I have finished an example of the tree out of the template, but when i try to include in the template It does not work. This is the sample

https://www.webslesson.info/2017/05/make-treeview-using-bootstrap-treeview-ajax-jquery-with-php.html

Could it be the version of bootstrap? Is there something I am missing?

Thanks in advance
themicon
themicon SELLER
5 years ago
Hi, do you have any details about the problem? I mean, it simply doesn't work or is there any JS error in browser console? If it's regarding styles, you can provide a screenshot (use imgur)
Optionally, you can send me a message via profile page so we can chat via email and you can send the code used so I can check exactly the same like you.

Thanks
Regards
sistemaontime
sistemaontime PURCHASED
5 years ago
Hello

Actually I have the following message in the browser console:

Uncaught TypeError: (...).treeview is not a function.

This is the function I use:

<script>
$(document).ready(function(){
$.ajax({
url: "./php/depto.php",
method:"POST",
dataType: "json",
success: function(data){
$('#treeview').treeview({data: data});
}
});
});
</script>

---

And this are the scripts and links in the header

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.css" />

Regards!!
themicon
themicon SELLER
5 years ago
Hi,

Your code should work fine, the only thing that is probably breaking the execution is the inclusion of jquery and bootstrap@3.3.6. jQuery is already available in the template so you don't need to include it again, and Bootstrap is also included in the template but is version 4, which will produce errors in styles in if you include v3
Try removing both libraries and reload the page.

I've received the message from you, if problem persists after previous changes I'll ask you for more details via email.
Regards