0

我的 jquery 树视图有问题。现在我正在使用这个:http ://struts.jgeppert.com/struts2-jquery-showcase/index.action

单击节点后,我想在选定的树节点上制作 css 背景。我该怎么办,请给我一些想法?在树节点上切换时显示css效果,但点击后没有显示css效果。

<sj:head jqueryui="true" jquerytheme="showcase" />在 head 标签中添加了这个

,在脚本中添加以下代码

$(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>
4

0 回答 0