I generate a Category Tree with the helper class in the following simple way:
$helper = new HelperTreeCategories('categories-treeview');
$helper->setUseCheckBox(1);
$helper->setRootCategory(Category::getRootCategory()->id);
$helper->setSelectedCategories($this->getSelectedCategories());
$category_tree = $helper->render();
return $category_tree;
On the frontend I recieve a Javascript error saying:
Uncaught TypeError: $(...).tree is not a function at HTMLDocument. (index.php?controller=AdminLindCategories&token=25f1a4c…&token=25f1a4c33d9a1…:1046) at j (jquery-1.11.0.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2) at Function.ready (jquery-1.11.0.min.js:2) at HTMLDocument.K (jquery-1.11.0.min.js:2) (anonymous) @ index.php?controller=AdminLindCategories&token=25f1a4c…&token=25f1a4c33d9a1…:1046 j @ jquery-1.11.0.min.js:2 fireWith @ jquery-1.11.0.min.js:2 ready @ jquery-1.11.0.min.js:2 K @ jquery-1.11.0.min.js:2
It seems like the HelperTreeCategories automatically writes out some Javascript to the DOM that tries to Check selected checkboxes. It tries to use the following code which cause the error:
$("#categories-treeview").tree("collapseAll");
I suspect that there is some .js file that I have to include in my controller. Anyone know anything about this? Which .js file is required for HelperTreeCategories?