|
@@ -35,17 +35,30 @@ class DropdownActions extends Actions
|
|
|
*/
|
|
|
protected function addScript()
|
|
|
{
|
|
|
- $script = <<<'SCRIPT'
|
|
|
-(function ($) {
|
|
|
- $('.table-responsive').on('show.bs.dropdown', function () {
|
|
|
- $('.table-responsive').css("overflow", "inherit" );
|
|
|
+ $script = <<<'JS'
|
|
|
+$(function() {
|
|
|
+ $('.table-responsive').on('shown.bs.dropdown', function(e) {
|
|
|
+ var t = $(this),
|
|
|
+ m = $(e.target).find('.dropdown-menu'),
|
|
|
+ tb = t.offset().top + t.height(),
|
|
|
+ mb = m.offset().top + m.outerHeight(true),
|
|
|
+ d = 20; // Space for shadow + scrollbar.
|
|
|
+
|
|
|
+ if (t[0].scrollWidth > t.innerWidth()) {
|
|
|
+ if (mb + d > tb) {
|
|
|
+ t.css('padding-bottom', ((mb + d) - tb));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ t.css('overflow', 'visible');
|
|
|
+ }
|
|
|
+ }).on('hidden.bs.dropdown', function() {
|
|
|
+ $(this).css({
|
|
|
+ 'padding-bottom': '',
|
|
|
+ 'overflow': ''
|
|
|
});
|
|
|
-
|
|
|
- $('.table-responsive').on('hide.bs.dropdown', function () {
|
|
|
- $('.table-responsive').css("overflow", "auto");
|
|
|
- })
|
|
|
-})(jQuery);
|
|
|
-SCRIPT;
|
|
|
+ });
|
|
|
+});
|
|
|
+JS;
|
|
|
|
|
|
Admin::script($script);
|
|
|
}
|