[英]JSTree JSON_DATA on IE7 and IE8
Having some problems getting JSTree to work with IE7 and 8. It works great on IE9, FF4 and Chrome.在让 JSTree 与 IE7 和 8 一起工作时遇到一些问题。它在 IE9、FF4 和 Chrome 上运行良好。
It is loading data via the JSON_DATA plugin backed by an ASP.NET MVC3 controller action.它通过由 ASP.NET MVC3 controller 操作支持的 JSON_DATA 插件加载数据。
The problem is that the data is not getting loaded into the tree on IE7-8.问题是数据没有加载到 IE7-8 上的树中。 I can verify the action is getting requested and no error is being thrown or at least caught in the error function.我可以验证正在请求操作,并且没有抛出错误或至少在错误 function 中被捕获。
$("#changeGroupTree")
.bind("select_node.jstree", function(event, data) {
// `data.rslt.obj` is the jquery extended node that was clicked
var id = data.rslt.obj.attr("id");
$("input[name='changeGroup_GroupId']").val(id)
.siblings("span")
.addClass("field-validation-valid")
.removeClass("field-validation-error");
$.ajax({
type: "GET",
url: "/api/group/gettree",
data: { groupId: id },
dataType: "JSON",
success: function(data, status, jqXHR) {
$("#changeGroup_SelectedGroup").html(data[0]);
},
error: function(jqXHR, textStatus, errorThrown) {
var data = $.parseJSON(jqXHR.responseText);
$().toastmessage("showErrorToast", data.ErrorMessage);
}
}); // end ajax
}) // end bind
.bind("loaded.jstree", function(event, data) {
})
.jstree({
core: {
animation: 200
},
plugins: ["themes", "json_data", "ui"],
themes: {
theme: "default",
dots: "true",
icons: "true"
},
ui: {
select_limit: 1
},
json_data: {
ajax: {
url: "/api/group/getgroups",
data: function(node) {
return { customerId: CUSTOMER_ID, parentId: (node.attr) ? node.attr("id") : "00000000-0000-0000-0000-000000000000" };
},
error: function(jqXHR, textStatus, errorThrown) {
alert("JSTree Error when getting Group data");
}
}
}
}); // end jstree
Here is the json that is returned from the server这是从服务器返回的 json
[{"attr":{"id":"d9cc2cb9-fbc4-4726-a9b1-9eee00f1e2b8"},"data":"MTM","state":"closed","icon":"Group"}] [{"attr":{"id":"d9cc2cb9-fbc4-4726-a9b1-9eee00f1e2b8"},"data":"MTM","state":"close","icon":"Group"}]
Am I missing something to get the data bound in the older IEs?我是否遗漏了一些东西来获取旧 IE 中的数据绑定?
Thanks,谢谢,
Turns out I had a self closing span tag in the html aka原来我在 html aka 中有一个自闭合跨度标签
<span class="field-validation-valid" />
Make this in to a well formed tag aka把它做成一个格式良好的标签,又名
And everything works perfectly.一切都很完美。
Sigh, a whole day fighting this叹息,一整天都在为此奋斗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.