【发布时间】:2015-06-30 08:41:58
【问题描述】:
我在 Bootstrap 中使用了 fancytree 插件。它在标准页面上运行良好,但是在模式中调用时,它什么也不做。
函数被声明,jQuery().fancytree 返回 true。
我也无法获得调试输出,所以看起来它根本没有被调用
定义了一个 id 为 ntree 的 DIV
我在模态中的 HTML
<div id="ntree"><div>
<script type="text/javascript">
jQuery(document).ready(function(){
// Create the tree inside the <div id="tree"> element.
console.log(jQuery().fancytree);
if (jQuery().fancytree){
alert("function exists");
$("#ntree").fancytree({
children: [ // Pass an array of nodes.
{title: "Item 1"},
{title: "Folder 2", isFolder: true,
children: [
{title: "Sub-item 2.1"},
{title: "Sub-item 2.2"}
]
},
{title: "Item 3"}
],
debugLevel: 2
});
} else {
alert("Fancytree is not declared");
}
});
</script>
【问题讨论】:
-
我向这个论坛道歉,因为在最初的帖子中没有提供足够的信息。我借此机会提供更多信息,以及经过更多努力后的发现,我正在寻求在 Vtiger CRM 的模态对话框中实施 fancytree。毫无疑问,它可以通过其他方式实现,就像我在 Vtiger 的其他 UI 组件中所做的那样,作为 Vtiger 小部件。下面的屏幕截图链接显示了结果。 screencast.com/t/Wo37GoBMN8R
-
Vtiger CRM 是许多开源库的实现,主要是用于 UI 的 jQuery 和 Bootstrap。在模态调用点,显示在屏幕上,有许多 css 和 js 在动作之前被调用。我的挑战是让它在 Vtiger 呈现的模态下工作。我能够使用与我的 Vtiger 实例中相同的 CSS 和 js 资源制作小提琴,并且 fancytree 组件运行良好。 jsfiddle.net/stprasad/fn0udjvo/4
-
我在目标环境中的各种加载点(包括 Header.tpl 和 JSResource.tpl)中包含了用于花式树的 CSS 和 JS,以查看是否有任何 CSS / JS 冲突世界得到解决。但似乎没有任何效果。我怀疑某处存在冲突,因为我可以使用评估为 true 的 if(Jquery.functiontree) 来确认函数的加载和存在。更多努力后
标签: jquery twitter-bootstrap modal-dialog fancytree