我有一個頁面,我想要jit Spacetree和jqgrid。但它正確顯示jqgrid或Spacetree。我通過AJAX請求加載JSON數據的Spacetree。 根節點永遠不會到來,但所有其他節點都來了,它是完全正常工作的。如果我刪除jqgrid包括然後樹加載與根節點。 我已經使用如何在同一頁面上使用jit spacetree和jqgrid?
http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example2.html
我已經更換3行example2.js具有這種功能
st.loadJSON(eval( $.parseJSON(json)));
st.compute();
st.onClick(st.root);
函數來獲得JSON數據
$.ajax({
type: "POST",
url: "../default.aspx",
data: {Mode: 'Tree'},
dataType: "text",
success: function(response) {
var response = $.parseJSON(response);
//load json data
st.loadJSON(response);
//compute node positions and layout
st.compute();
//optional: make a translation of the tree
// st.geom.translate(new $jit.Complex(-200, 0), "current");
//emulate a click on the root node.
st.onClick(st.root);
// NodeId=st.root;
},
error: function(rs, e) {
//alert(rs.responseText);
return false;
}
});
我有spacetree的該示例使用此jqgrid
http://jsfiddle.net/amorris/yNw3C/
我已經包括以下的HTML
- 的jqGrid-4.4.5-SRC/ui.jqgrid.css文件,
- 的jqGrid-4.4.5-SRC/jquery.jqGrid.js,
- 的jqGrid-4.4.5-SRC/jQuery的ui.css,
- 的jqGrid-4.4.5-SRC/grid.locale-en.js,