Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery "Chosen" dropdown cut when appearing

I use JQuery "Chosen Dropdowns" plugin and have an issue that when dropdown appear inside modal form it cut's and show's only partially, although parent div for chosen select has css property overflow: visible

enter image description here

Normally, when I use default select without any styling it works good

enter image description here

Maybe someone has same issue or can provide any solution?

HTML:

<div class="addNewLicense" style="overflow:visible;">
<table>
    <tr>
        <td>
            <span>Start date: </span>
        </td>
        <td>
            <input type="text" id="startLicenseDate" placeholder="Start Date..." style="width: 200px; height: 24px;" />
        </td>
    </tr>
    <tr>
        <td>
            <span>End date: </span>
        </td>
        <td>
            <input type="text" id="endLicenseDate" placeholder="End Date..." style="width: 200px; height: 24px;" />
        </td>
    </tr>
    <tr>
        <td>
            <span>State Name: </span>
        </td>
        <td>
            <select id="stateLicenseSelect" style="width: 205px; height: 30px;">

            </select>
        </td>
    </tr>
</table>

Javascript:

    $("#stateLicenseSelect").chosen({ width: "200px", disable_search: true });
    $(".addNewLicense").dialog('open');
like image 853
Alex44 Avatar asked Oct 02 '14 09:10

Alex44


3 Answers

jQuery UI modals have overflow with hidden value by default, that to prevent any over sized object to leave the box boundaries. It won't crop the native UI controls from the browser because it would break user experience rules, but for script generated UI, it will. Chosen works replacing the select input elements with some absolute positioned elements that will be cut with overflow hidden.

To prevent this issue, you simply overwrite the overflow hidden property from jQuery UI:

.ui-dialog{
overflow: visible !important;
}

I made a quick example here: http://jsfiddle.net/e57gase7/

If you try removing the CSS in the example, it would look like your problem.

like image 182
marcovega Avatar answered Nov 16 '22 23:11

marcovega


.mCSB_container {
overflow:visible !important;
}

Worked for me!!!

like image 44
hammad shahid Avatar answered Nov 16 '22 23:11

hammad shahid


Try to replace your chosen with select2. It has more functionality, and should work in your situation.

like image 1
Fenistil Avatar answered Nov 16 '22 23:11

Fenistil