IE7 和 IE8 上的 JSTree JSON_DATA
让 JSTree 在 IE7 和 8 上运行时遇到一些问题。它在 IE9、FF4 和 Chrome 上运行得很好。
它通过由 ASP.NET MVC3 控制器操作支持的 JSON_DATA 插件加载数据。
问题是数据没有加载到 IE7-8 上的树中。我可以验证是否正在请求该操作,并且没有抛出任何错误,或者至少没有在错误函数中捕获错误。
$("#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
这是从服务器返回的 json
[{"attr":{"id":"d9cc2cb9-fbc4-4726-a9b1-9eee00f1e2b8"},"data":"MTM","state":"lated", "icon":"Group"}]
我是否缺少一些东西来获取旧版 IE 中的数据绑定?
谢谢,
Having some problems getting JSTree to work with IE7 and 8. It works great on IE9, FF4 and Chrome.
It is loading data via the JSON_DATA plugin backed by an ASP.NET MVC3 controller action.
The problem is that the data is not getting loaded into the tree on IE7-8. I can verify the action is getting requested and no error is being thrown or at least caught in the error 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
[{"attr":{"id":"d9cc2cb9-fbc4-4726-a9b1-9eee00f1e2b8"},"data":"MTM","state":"closed","icon":"Group"}]
Am I missing something to get the data bound in the older IEs?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我在 html 中有一个自动关闭的跨度标签,又名
将其放入格式良好的标签
,又名一切都运行良好。
唉,一整天都在为此奋斗
Turns out I had a self closing span tag in the html aka
Make this in to a well formed tag aka
And everything works perfectly.
Sigh, a whole day fighting this