LaravelTest
85 строк · 2.0 Кб
1/*! Bootstrap 4 integration for DataTables' Responsive
2* ©2016 SpryMedia Ltd - datatables.net/license
3*/
4
5(function( factory ){6if ( typeof define === 'function' && define.amd ) {7// AMD8define( ['jquery', 'datatables.net-bs4', 'datatables.net-responsive'], function ( $ ) {9return factory( $, window, document );10} );11}12else if ( typeof exports === 'object' ) {13// CommonJS14module.exports = function (root, $) {15if ( ! root ) {16root = window;17}18
19if ( ! $ || ! $.fn.dataTable ) {20$ = require('datatables.net-bs4')(root, $).$;21}22
23if ( ! $.fn.dataTable.Responsive ) {24require('datatables.net-responsive')(root, $);25}26
27return factory( $, root, root.document );28};29}30else {31// Browser32factory( jQuery, window, document );33}34}(function( $, window, document, undefined ) {35'use strict';36var DataTable = $.fn.dataTable;37
38
39var _display = DataTable.Responsive.display;40var _original = _display.modal;41var _modal = $(42'<div class="modal fade dtr-bs-modal" role="dialog">'+43'<div class="modal-dialog" role="document">'+44'<div class="modal-content">'+45'<div class="modal-header">'+46'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>'+47'</div>'+48'<div class="modal-body"/>'+49'</div>'+50'</div>'+51'</div>'52);53
54_display.modal = function ( options ) {55return function ( row, update, render ) {56if ( ! $.fn.modal ) {57_original( row, update, render );58}59else {60if ( ! update ) {61if ( options && options.header ) {62var header = _modal.find('div.modal-header');63var button = header.find('button').detach();64
65header
66.empty()67.append( '<h4 class="modal-title">'+options.header( row )+'</h4>' )68.append( button );69}70
71_modal.find( 'div.modal-body' )72.empty()73.append( render() );74
75_modal
76.appendTo( 'body' )77.modal();78}79}80};81};82
83
84return DataTable.Responsive;85}));86