Browse Source

Merge pull request #6 from wenzhixin/master

Merging with recent changes
Troy Morehouse 10 years ago
parent
commit
026b03bb85

+ 6 - 0
docs/_i18n/en/extensions/export.md

@@ -16,6 +16,12 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jqu
 * description: set `true` to show export button.
 * default: `false`
 
+### exportDataType
+
+* type: String
+* description: export data type, support: 'basic', 'all', 'selected'.
+* default: `basic`
+
 ### exportTypes
 
 * type: Array

+ 0 - 7
docs/_i18n/en/extensions/mobile.md

@@ -33,10 +33,3 @@ Use Plugin: [bootstrap-table-mobile](https://github.com/wenzhixin/bootstrap-tabl
 * type: Integer
 * description: Set the minimum height when the table will change the view.
 * default: `undefined`
-
-### heightThreshold
-
-* type: Integer
-* description: minimum change in height in pixels before cardView is triggered.
-Usefull for mobile browsers that auto hide/show the toolbar on vertical scroll.
-* default: `100`

+ 6 - 0
docs/_i18n/en/extensions/reorder-columns.md

@@ -28,6 +28,12 @@ Dependence: [dragTable](https://github.com/akottr/dragtable/) v2.0.14 (must incl
 * description: Moving only the header. Recommended for very large tables (cells > 1000)
 * default: `10`
 
+### dragaccept
+
+* type: String
+* description: Allow to drag only the rows that have the css class as attribute.
+* default: `null`
+
 ## Events
 
 ### onReorderColumn(reorder-column.bs.table)

+ 6 - 0
docs/_i18n/es/extensions/export.md

@@ -16,6 +16,12 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jqu
 * description: set `true` to show export button.
 * default: `false`
 
+### exportDataType
+
+* type: String
+* description: export data type, support: 'basic', 'all', 'selected'.
+* default: `basic`
+
 ### exportTypes
 
 * type: Array

+ 6 - 0
docs/_i18n/es/extensions/reorder-columns.md

@@ -28,6 +28,12 @@ Dependence: [dragTable](https://github.com/akottr/dragtable/) v2.0.14 (must incl
 * description: Moving only the header. Recommended for very large tables (cells > 1000)
 * default: `10`
 
+### dragaccept
+
+* type: String
+* description: Allow to drag only the rows that have the css class as attribute.
+* default: `null`
+
 ## Events
 
 ### onReorderColumn(reorder-column.bs.table)

+ 6 - 0
docs/_i18n/zh-cn/extensions/export.md

@@ -16,6 +16,12 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jqu
 * description: set `true` to show export button.
 * default: `false`
 
+### exportDataType
+
+* type: String
+* description: export data type, support: 'basic', 'all', 'selected'.
+* default: `basic`
+
 ### exportTypes
 
 * type: Array

+ 6 - 0
docs/_i18n/zh-cn/extensions/reorder-columns.md

@@ -28,6 +28,12 @@ Dependence: [dragTable](https://github.com/akottr/dragtable/) v2.0.14 (must incl
 * description: Moving only the header. Recommended for very large tables (cells > 1000)
 * default: `10`
 
+### dragaccept
+
+* type: String
+* description: Allow to drag only the rows that have the css class as attribute.
+* default: `null`
+
 ## Events
 
 ### onReorderColumn(reorder-column.bs.table)

+ 6 - 0
src/extensions/export/README.md

@@ -16,6 +16,12 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jqu
 * description: set `true` to show export button.
 * default: `false`
 
+### exportDataType
+
+* type: String
+* description: export data type, support: 'basic', 'all', 'selected'.
+* default: `basic`
+
 ### exportTypes
 
 * type: Array

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

@@ -21,6 +21,7 @@
 
     $.extend($.fn.bootstrapTable.defaults, {
         showExport: false,
+        exportDataType: 'basic', // basic, all, selected
         // 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'powerpoint', 'pdf'
         exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
         exportOptions: {}
@@ -73,10 +74,28 @@
                 });
 
                 $menu.find('li').click(function () {
-                    that.$el.tableExport($.extend({}, that.options.exportOptions, {
-                        type: $(this).data('type'),
-                        escape: false
-                    }));
+                    var type = $(this).data('type'),
+                        doExport = function () {
+                            that.$el.tableExport($.extend({}, that.options.exportOptions, {
+                                type: type,
+                                escape: false
+                            }));
+                        };
+
+                    if (that.options.exportDataType === 'all' && that.options.pagination) {
+                        that.togglePagination();
+                        doExport();
+                        that.togglePagination();
+                    } else if (that.options.exportDataType === 'selected') {
+                        var data = that.getData(),
+                            selectedData = that.getAllSelections();
+
+                        that.load(selectedData);
+                        doExport();
+                        that.load(data);
+                    } else {
+                        doExport();
+                    }
                 });
             }
         }