responsive.jqueryui.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*! jQuery UI integration for DataTables' Responsive
  2. * ©2015 SpryMedia Ltd - datatables.net/license
  3. */
  4. (function( factory ){
  5. if ( typeof define === 'function' && define.amd ) {
  6. // AMD
  7. define( ['jquery', 'datatables.net-jqui', 'datatables.net-responsive'], function ( $ ) {
  8. return factory( $, window, document );
  9. } );
  10. }
  11. else if ( typeof exports === 'object' ) {
  12. // CommonJS
  13. module.exports = function (root, $) {
  14. if ( ! root ) {
  15. root = window;
  16. }
  17. if ( ! $ || ! $.fn.dataTable ) {
  18. $ = require('datatables.net-jqui')(root, $).$;
  19. }
  20. if ( ! $.fn.dataTable.Responsive ) {
  21. require('datatables.net-responsive')(root, $);
  22. }
  23. return factory( $, root, root.document );
  24. };
  25. }
  26. else {
  27. // Browser
  28. factory( jQuery, window, document );
  29. }
  30. }(function( $, window, document, undefined ) {
  31. 'use strict';
  32. var DataTable = $.fn.dataTable;
  33. var _display = DataTable.Responsive.display;
  34. var _original = _display.modal;
  35. _display.modal = function ( options ) {
  36. return function ( row, update, render ) {
  37. if ( ! $.fn.dialog ) {
  38. _original( row, update, render );
  39. }
  40. else {
  41. if ( ! update ) {
  42. $( '<div/>' )
  43. .append( render() )
  44. .appendTo( 'body' )
  45. .dialog( $.extend( true, {
  46. title: options && options.header ? options.header( row ) : '',
  47. width: 500
  48. }, options.dialog ) );
  49. }
  50. }
  51. };
  52. };
  53. return DataTable.Responsive;
  54. }));