Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Transform all Adminer selects into select2 (for filtering)
<?php
class AdminerSelect2
{
function head() {
?>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script>
jQuery(document).ready(function($) {
initSelect2();
jQuery('legend a').on('click', function(e) {
initSelect2();
});
});
function initSelect2() { jQuery('select').select2(); }
</script>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment