Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to stick jquery ui tabs inside of a jquery ui dialog

i have a web page that i want to load dynamically (ajax) into a jquery ui dialog. the page has multiple jquery tabs and when i load this into the dialog each tab is showing up as a regular link and the tab widget is not shown. Is this a known issue? Is there any workaround to support having jquery ui tabs inside of a dialog.

like image 427
leora Avatar asked Mar 17 '11 14:03

leora


People also ask

What is jQuery UI dialog?

The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.

How make jQuery UI dialog responsive?

Below is how I achieved a responsive jQuery UI Dialog. To do this, I added a new option to the config - fluid: true , which says to make the dialog responsive. I then catch the resize and dialog open events, to change the max-width of the dialog on the fly, and reposition the dialog.

How do I select a tab in jQuery?

With the latest versions of jQuery is not not trivial to select a tab by ID as it was before. $("#tabs"). tabs("option", "active", index); where index is the ordinal number counting tabs from left to right.


2 Answers

yes its possible. here is a simple example ...

JS Fiddle Example

like image 196
stephen776 Avatar answered Oct 14 '22 18:10

stephen776


You might want to add an open handler to retrieve your content and set up the tabs when you do so.

$(function() {
    $('#dialog').dialog({
        autoOpen: false,
        modal: true,
        buttons: {
            'OK' : function() {
                        $(this).dialog('close');
                   },
            'Cancel': function() {
                        $(this).dialog('close');
                   }
        },
        open: function(event,ui) {
           $(ui.panel).find('div')
                      .load('http://www.example.com')
                      .find('.tabs')
                      .tabs();
        }
    });
    $('.dialog-button').click( function() {
        $('#dialog').dialog('open');
        return false;
    });
});

<div id="dialog"  title="Dialog" style="display: none;">
    <div class="dialog-content">
    </div>
</div>
like image 5
tvanfosson Avatar answered Oct 14 '22 17:10

tvanfosson