简体   繁体   中英

using jqtree and jquery ui tabs

I'm trying to create a document managment with editor and stuff.

I got following code:

<script src="js/ide/lib/codemirror.js"></script>
<link rel="stylesheet" href="js/ide/lib/codemirror.css">
<!-- Tree -->
<div class="masterAdmin">
    <div class="masterAdminNavigation float_left" id="tree">
        <div id="ideFS" data-url="{link modul="ide" operation="home" action="tree"}"></div>
    </div>
    <div class="masterAdminContent float_left">
        <div id="tabs">
            <ul></ul>
        </div>
    </div>
</div>
<script>
{literal}
    $(function(){
        var tabCounter = 0;
        tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>",
        $('#ideFS').tree({
            saveState: 'ideFStree',
        });
        var tabs = $( "#tabs" ).tabs();
        $('#ideFS').bind(
            'tree.click',
            function(event){
                var node = event.node;
                //node type: node.class
                var li = $( tabTemplate.replace( /#\{href\}/g, "{/literal}{link modul="ide" operation="editor" action="edit"}{literal}?fileid="+node.id ).replace( /#\{label\}/g, node.name ) );
                tabs.find( ".ui-tabs-nav" ).append( li );
                tabs.tabs( "refresh" );
            }
        );
        tabs.delegate( "span.ui-icon-close", "click", function() {
          var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
          $( "#" + panelId ).remove();
          tabs.tabs( "refresh" );
        });
    });
{/literal}
</script>

It works so far. It opens a new tab and loads the code into an editor. Only problem is, these tabs aren't open'd by default. You have to click on the first tab to open it. I don't really understand the problem of this, because it loads without any problems. ????

Problem here was the base path in the header. I removed it and all problems where solved ^^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM