我的jquery树视图有问题。现在我正在使用它:http://struts.jgeppert.com/struts2-jquery-showcase/index.action
我希望在单击节点后在选定的树节点上创建css背景。我该怎么办,请给我一些想法?在树节点上切换时显示css效果 但是,点击后,css效果不显示。
我在头标记中添加了<sj:head jqueryui="true" jquerytheme="showcase" />
,在脚本中添加了以下代码
$(function(){
$.subscribe('treeClicked', function (event, data){
alert("treeClicked");// check if script called on page load
//Get the next item, this is the tree node object is selected, many operations need it
var item = event.originalEvent.data.rslt.obj;
//For example, we want to select the node id suggest, you can write like this
alert ('Clicked ID : ' + item.attr ("id"));
document.getElementById("g_selected_uid").value = item.attr("id");
document.forms.selectedUnitForm.submit();
//self.close();
});
});
然后这是我的jquery树代码 -
<sjt:tree id="treeDynamicAjax"
jstreetheme="apple"
rootNode="#session.UNT_LIST"
childCollectionProperty="children"
nodeTitleProperty="title"
nodeIdProperty="id"
openAllOnLoad="true"
onClickTopics="treeClicked"
></sjt:tree>