Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery dynatree在第一次单击单选按钮时不作出反应_Jquery_Ruby On Rails_Ruby_Dynatree - Fatal编程技术网

Jquery dynatree在第一次单击单选按钮时不作出反应

Jquery dynatree在第一次单击单选按钮时不作出反应,jquery,ruby-on-rails,ruby,dynatree,Jquery,Ruby On Rails,Ruby,Dynatree,我使用单击功能在rails应用程序中移动radiobutton旁边的编辑菜单。除了第一次单击单选按钮没有效果外,它工作正常。但是,第二次单击和另一个或同一个按钮会移动菜单。每个扩展的子菜单也会出现这种情况 任何帮助都将不胜感激 下面是一些代码 $("#document_tree").dynatree({ checkbox: true, classNames: {checkbox: "dynatree-radio"}, selectMod

我使用单击功能在rails应用程序中移动radiobutton旁边的编辑菜单。除了第一次单击单选按钮没有效果外,它工作正常。但是,第二次单击和另一个或同一个按钮会移动菜单。每个扩展的子菜单也会出现这种情况

任何帮助都将不胜感激

下面是一些代码

 $("#document_tree").dynatree({
         checkbox: true,
          classNames: {checkbox: "dynatree-radio"},
          selectMode: 1,
          onActivate: function(node) {

                if( node.attr("href") ){
                    window.location.href = node.attr("href"); }
          },
          onSelect: function(select, node) {
            var selectedNode = node;
                $("#show_button").attr("href","/documents/"+selectedNode.data.key+"?documented_type=<%=@documented_type%>");    
                $("#edit_button").attr("href","/documents/"+selectedNode.data.key+"/edit"+"?documented_type=<%=@documented_type%>");    
                $("#new_folder_button").attr("href","/documents/new?id="+selectedNode.data.key+"&kind=folder"+"&documented_type=<%=@documented_type%>");
                $("#new_document_button").attr("href","/documents/new?id="+selectedNode.data.key+"&kind=document"+"&documented_type=<%=@documented_type%>");
                $("#new_link_button").attr("href","/documents/new?id="+selectedNode.data.key+"&kind=link"+"&documented_type=<%=@documented_type%>");
                $("#destroy_button").attr("href","/documents/"+selectedNode.data.key+"?documented_type=<%=@documented_type%>");
很抱歉用这个问题打扰你。我在上次尝试谷歌搜索时找到了解决方案。 解决办法是使用 $(“.dynatree radio”).live('click',函数(e){ 而不仅仅是 “$(“.dynatree radio”)。单击(函数(e){

            $(".dynatree-radio").click(function(e){
               var mouseX=e.pageX;
               var mouseY=e.pageY-10;
            $("#tree_menu").css({left:'25px',top:mouseY});
                });

      },