请教一个jquery树问题 jstree里的data要一次全加载完么?能不能通过id动态取节点? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的JS是这样:URL是一个servlet.<script type="text/javascript"> $(function() { $("#menu").tree( { data : { type : "json", url : "Tree", async : true, async_data : function (NODE) { return { id : 100000, my_param : "1" } } }, ui : { dots : false, // BOOL - dots or no dots rtl : false, // BOOL - is the tree right-to-left animation : 0, // INT - duration of open/close animations in miliseconds hover_mode : true, // SHOULD get_* functions chage focus or change hovered item scroll_spd : 4, theme_path : "themes/", // Path to themes theme_name : "classic"// Name of theme }, callback : { onselect : function(NODE,TREE_OBJ) { var id = $(NODE).attr("id"); alert(id); } } }); });</script> <script type="text/javascript">$(function() {$("#menu").tree( {data : {type : "json",url : "Tree",async : true,async_data : function (NODE) { return { id : 100000, my_param : "1" } }},ui : {dots : false, // BOOL - dots or no dotsrtl : false, // BOOL - is the tree right-to-leftanimation : 0, // INT - duration of open/close animations in milisecondshover_mode : true, // SHOULD get_* functions chage focus or change hovered itemscroll_spd : 4,theme_path : "themes/", // Path to themestheme_name : "classic"// Name of theme}, callback : { onselect : function(NODE,TREE_OBJ) {var id = $(NODE).attr("id");alert(id);} }});当然可以了 不过要注意你用的版本 data : { type : "json", url : "Tree", async : true, async_data : function (NODE) return { parent_Id : $(NODE).attr("id") || 0} } }为什么我不可以把 async_data 属性里的parent_Id将节点的ID传到后台,然后再通过ID获取该节点下的子节点么? 配置struts2报错,求大神帮忙,在线等 CAS配置TOMCAT 服务器端 导入commons-dbcp.jar报的转型错误!!!!求解决 axis2方面的问题 关于Hibernate的继承映射的问题 急!!! Struts中的Tiles模板里使用框架的问题 如何用XSLT生成带CDATA段的xml文档? java servlet例子怎么调试啊? queryDataSet和jdbTable的问题 谁能提供一个java解析xml的原码?包括插入与删除接点! 紧急问题求教 新人初学struts2出错,求解答 求解在spring框架下如何分层打包jar
URL是一个servlet.
<script type="text/javascript">
$(function() {
$("#menu").tree( {
data : {
type : "json",
url : "Tree",
async : true,
async_data : function (NODE) {
return { id : 100000, my_param : "1" }
}
},
ui : {
dots : false, // BOOL - dots or no dots
rtl : false, // BOOL - is the tree right-to-left
animation : 0, // INT - duration of open/close animations in miliseconds
hover_mode : true, // SHOULD get_* functions chage focus or change hovered item
scroll_spd : 4,
theme_path : "themes/", // Path to themes
theme_name : "classic"// Name of theme
},
callback : {
onselect : function(NODE,TREE_OBJ) {
var id = $(NODE).attr("id");
alert(id);
}
}
});
});
</script>
$(function() {
$("#menu").tree( {
data : {
type : "json",
url : "Tree",
async : true,
async_data : function (NODE) {
return { id : 100000, my_param : "1" }
}
},
ui : {
dots : false, // BOOL - dots or no dots
rtl : false, // BOOL - is the tree right-to-left
animation : 0, // INT - duration of open/close animations in miliseconds
hover_mode : true, // SHOULD get_* functions chage focus or change hovered item
scroll_spd : 4,
theme_path : "themes/", // Path to themes
theme_name : "classic"// Name of theme
},
callback : {
onselect : function(NODE,TREE_OBJ) {
var id = $(NODE).attr("id");
alert(id);
}
}
});
当然可以了 不过要注意你用的版本
type : "json",
url : "Tree",
async : true,
async_data : function (NODE) return { parent_Id : $(NODE).attr("id") || 0}
}
}
为什么我不可以把 async_data 属性里的parent_Id将节点的ID传到后台,然后再通过ID获取该节点下的子节点么?