jQuery dialog width resizing problem

Posted by ktMen on Stack Overflow See other posts from Stack Overflow or by ktMen
Published on 2010-04-19T06:03:04Z Indexed on 2010/04/19 6:13 UTC
Read the original article Hit count: 353

I try to load some HTML code into a jQueryUI dialog by AJAX. The code itself is a list, where rightmost elements should be absolutely positioned so that the list looks like a table with two columns, but only in some rows. The problem is that jQueryUI plugin does not seem to be correctly resizing the dialog's width, which I think is due to the absolute positioning of some li's. I have read some answers to other similar questions, but none helped me out with this.

This is the code I load:

 <style type="text/css">

     ul {list-style-type:none;margin:0px;padding:0px;}
     ul ul  {margin:0px;padding:0px;}
     ul>li.fila {margin-bottom:5px;padding-bottom:5px;}

     ul li.fila ul li
     {
      display:inline;
      padding-left:20px;
      position:relative;
      margin-bottom:10px;
     }
     ul li.fila ul li.O  
     {
      background:url(bullet.gif) 5px 8px no-repeat;
      list-style-position:inside;
     }

    </style>

    <ul id="raiz" >
     <li class="fila">
      <ul >
       <li style="position:absolute;left:0px;" class="O">
        <label for="col1">Col1:</label>
        <input type="text" name="col1" id="col1" value="vCol1" class="text ui-widget-content ui-corner-all" />
       </li>
       <li  style="left:250px;" class="O" >
        <label for="col2">Col2:</label>
        <input type="text" name="col2" id="col2" value="vCol2" class="text ui-widget-content ui-corner-all" />
       </li>
      </ul>
     </li>
     <li class="fila">
      <ul >
       <li>
        <label for="col3">Col3:</label>
        <input type="text" name="col3" id="col3" value="vCol3" class="text ui-widget-content ui-corner-all" />
       </li>
      </ul>
     </li>
    </ul>

And the Dialog constructor:

$("#dialog").dialog({
        bgiframe: true,
        autoOpen: false,
        height: 'auto',
        width: 'auto',
        modal: true,
        buttons:{
            'Cancel': function() {
                $(this).dialog('close');
            }
        },
        open: function(event,ui){               
            $("#dialog").load("dialogCode.html");
        }
    }); 

Thanks in advance for any suggestions.

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about dialog