有许多用于创建复选框树视图的jQuery插件,但我找不到使用AJAX从服务器加载数据的文档。例如this link。
我想要这样的东西:
$('#CheckBoxTree').LoadTreeView('/WebHandler/GetData.ashx') {
}或者使用经典的ajax格式
$.ajax({
url: '/WebHandler/Data.ashx',
async: true,
dataType: 'json',
data: { proname: 'pro' },
success: function (dataa) {
$('#CheckBoxTree').SetData(dataa)
});
}
});我尝试在一个插件上使用第二种技术,但失败了。我这样做了:
$.ajax({
url: '/WebHandler/GetPlotData.ashx',
async: true,
dataType: 'json',
data: { proname: 'province' },
success: function (dataa) {
debugger
$('#tree-container').highCheckTree({
data: dataa
});
}
});请帮助我,让我可以继续我的工作。谢谢。
发布于 2016-07-15 13:30:17
我用的是DynaTree,它有很多文档。这是一个Link,它有很多旧版本,可以与旧的jquery相媲美。
我只需要写这么多代码。
$("#tree").dynatree({
checkbox: true,
autoCollapse: false,
activeVisible: true,
persist: true,
// selectMode: 1,
onLazyRead: function (node) {
node.appendAjax({
url: "/WebHandler/GetPlotData.ashx",
data: {
"proname": "district",
"key":node.data.key,
"mode": "all"
}
});
},
initAjax: {
url: "/WebHandler/GetPlotData.ashx",
data: {proname: "province", // Optional arguments to append to the url
mode: "all"
}
},
});https://stackoverflow.com/questions/38346214
复制相似问题