Improved: Move page-specific script links to html template
Use importLibrary js function to load jstree js at ProductStoreGroupTree.ftl
Tested at
@@ -17,8 +17,6 @@ specific language governing permissions and limitations
under the License.
-->
-<script src="/common/js/jquery/plugins/jsTree/jquery.jstree.js" type="application/javascript" data-import="head"></script>
-
<script type="application/javascript">
<#-- some labels are not unescaped in the JSON object so we have to do this manualy -->
function unescapeHtmlText(text) {
@@ -47,11 +45,13 @@ var rawdata = [
<#-- create Tree-->
function createTree() {
jQuery(function () {
+ importLibrary(["/common/js/jquery/plugins/jsTree/jquery.jstree.js"], function() {
jQuery("#tree").jstree({
"plugins": ["themes", "json_data", "ui", "cookies", "types"],
"json_data": {
"data": rawdata,
- "ajax" : { "url" : "<@ofbizUrl>getProductStoreGroupRollupHierarchy</@ofbizUrl>",
+ "ajax": {
+ "url": "<@ofbizUrl>getProductStoreGroupRollupHierarchy</@ofbizUrl>",
"type": "POST",
"data": function (n) {
return {
@@ -66,9 +66,14 @@ var rawdata = [
},
"types": {
"valid_children": ["root"]
+ },
+ "themes": {
+ "theme": "default",
+ "url": "/common/js/jquery/plugins/jsTree/themes/default/style.css"
}
});
});
+ });
}
function callDocument(id) {
