ソースを参照

Refs #640: add exportOptions.

zhixin 10 年 前
コミット
be7bc081f0

+ 7 - 1
src/extensions/export/README.md

@@ -20,4 +20,10 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/kayalshri/tableExport
 
 * type: Array
 * description: export types, support types: 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'powerpoint', 'pdf'.
-* default: `['json', 'xml', 'csv', 'txt', 'sql', 'excel']`
+* default: `['json', 'xml', 'csv', 'txt', 'sql', 'excel']`
+
+### exportOptions
+
+* type: Object
+* description: export [options](https://github.com/kayalshri/tableExport.jquery.plugin#options) of `tableExport.jquery.plugin`
+* default: `{}`

+ 5 - 4
src/extensions/export/bootstrap-table-export.js

@@ -22,7 +22,8 @@
     $.extend($.fn.bootstrapTable.defaults, {
         showExport: false,
         // 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'powerpoint', 'pdf'
-        exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel']
+        exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
+        exportOptions: {}
     });
 
     var BootstrapTable = $.fn.bootstrapTable.Constructor,
@@ -72,12 +73,12 @@
                 });
 
                 $menu.find('li').click(function () {
-                    that.$el.tableExport({
+                    that.$el.tableExport($.extend({}, that.options.exportOptions, {
                         type: $(this).data('type'),
                         escape: false
-                    });
+                    }));
                 });
             }
         }
     };
-})(jQuery);
+})(jQuery);