jquery - JSTREE:列表未填充到 jquery 对话框中
问题描述
在成功的 ajax 调用中,我在 jquery 对话框中动态创建了一个 JSTREE,我正在获取要在控制台上显示的值。但树上什么也没有。我尝试了网站上的一些建议,但似乎没有显示列表。
success : function(data) {
tmp7 += "<div style='width:600px;'>";
tmp7 +="<br/>";
tmp7 +="<div id='diagTree' style='width:200px; height:300px; float:left; background-color:white;'>";
tmp7 +="<br/>";
tmp7 +="<div id='notetree' style='text-align: left'>";
tmp7 +="</div>";
tmp7 +="</div>";
tmp7 +="<div style='width:400px; height:300px; float:left; background-color:white;'></div>";
tmp7 += "</div>";
var typelist = '<ul class="notetypelist">';
$.each(data, function(key, val){
typelist += "<li id='"+data[key].technicalid+"' name='nttype'"+counter+"' value='" + data[key].note_type + "'>" +techtype + "</li>";
});
typelist += '</ul>';
$("#notetree").jstree();
//$('#notetree').html(typelist);
$('#notetree').jstree(true).settings.core.data = typelist;
$('#notetree').jstree(true).refresh();
}
var newDiv = $(document.createElement('div'));
$(newDiv).html(tmp7);
$(newDiv).dialog({});
解决方案
我通过在 html 页面上创建一个隐藏的潜水来解决这个问题,然后将其附加到对话框并启用它。使用此链接提示显示:jQuery Append/Add Hidden div to jQuery Dialog
推荐阅读
- java - @ConfigurationProperties 的默认值不存在
- android - 在 Android P 中以有效的方式获取 android.os.SystemProperties
- angular - 角度应用程序中的 Firebase 功能不起作用
- php - 使用 $_GET['value'] 作为指针的动态页面内容
- ajax - 如何检查记录是否存在于laravel中?
- asynchronous - 如何管理 Dialogflow / Api.ai 中的 5 秒响应超时限制?
- webmail - 如何删除网络邮件中任何给定日期之前的电子邮件?
- mongodb - GroupBy 使用 cond 选择字段
- php - 如何从多维数组中获取所有值
- python - 创建具有实际值的虚拟列