Browse Source

Merge pull request #78 from wenzhixin/master

Update my repo
Dennis Hernández 10 years ago
parent
commit
efd3f119cc

+ 1 - 0
DONATORS.md

@@ -14,3 +14,4 @@
 * Marzena Wspanialy - $10
 * Marzena Wspanialy - $10
 * Nicolas Pascual - $10
 * Nicolas Pascual - $10
 * Hassan Ejaz - $10
 * Hassan Ejaz - $10
+* Frank Hines - $100

+ 2 - 2
README.md

@@ -1,7 +1,7 @@
 # [Bootstrap Table](http://bootstrap-table.wenzhixin.net.cn)
 # [Bootstrap Table](http://bootstrap-table.wenzhixin.net.cn)
 
 
-[![Build Status](https://travis-ci.org/wenzhixin/bootstrap-table.png)](https://travis-ci.org/wenzhixin/bootstrap-table) 
-[![GitHub version](https://badge.fury.io/gh/wenzhixin%2Fbootstrap-table.png)](http://badge.fury.io/gh/wenzhixin%2Fbootstrap-table)
+[![Build Status](https://travis-ci.org/wenzhixin/bootstrap-table.svg)](https://travis-ci.org/wenzhixin/bootstrap-table) 
+[![GitHub version](https://badge.fury.io/gh/wenzhixin%2Fbootstrap-table.svg)](http://badge.fury.io/gh/wenzhixin%2Fbootstrap-table)
 [![Bower version](https://badge.fury.io/bo/bootstrap-table.svg)](http://badge.fury.io/bo/bootstrap-table)
 [![Bower version](https://badge.fury.io/bo/bootstrap-table.svg)](http://badge.fury.io/bo/bootstrap-table)
 [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDHP676FQDUT6)
 [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDHP676FQDUT6)
 
 

+ 43 - 0
dist/locale/bootstrap-table-ca-ES.js

@@ -0,0 +1,43 @@
+/**
+ * Bootstrap Table Catalan translation
+ * Author: Marc Pina<iwalkalone69@gmail.com>
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['ca-ES'] = {
+        formatLoadingMessage: function () {
+            return 'Si us plau esperi...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' resultats per pàgina';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Mostrant de la pàgina ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats';
+        },
+        formatSearch: function () {
+            return 'Buscar';
+        },
+        formatNoMatches: function () {
+            return 'No s\'han trobat resultats';
+        },
+        formatPaginationSwitch: function () {
+            return 'Amagar/Mostrar paginació';
+        },
+        formatRefresh: function () {
+            return 'Refrescar';
+        },
+        formatToggle: function () {
+            return 'Amagar/Mostrar';
+        },
+        formatColumns: function () {
+            return 'Columnes';
+        },
+        formatAllRows: function () {
+            return 'Tots';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ca-ES']);
+
+})(jQuery);

File diff suppressed because it is too large
+ 7 - 0
dist/locale/bootstrap-table-ca-ES.min.js


+ 43 - 0
dist/locale/bootstrap-table-es-ES.js

@@ -0,0 +1,43 @@
+/**
+ * Bootstrap Table Spanish Spain translation
+ * Author: Marc Pina<iwalkalone69@gmail.com>
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['es-ES'] = {
+        formatLoadingMessage: function () {
+            return 'Por favor espere...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' resultados por página';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Mostrando desde la página ' + pageFrom + ' hasta ' + pageTo + ' - En total ' + totalRows + ' resultados';
+        },
+        formatSearch: function () {
+            return 'Buscar';
+        },
+        formatNoMatches: function () {
+            return 'No se encontraron resultados';
+        },
+        formatPaginationSwitch: function () {
+            return 'Ocultar/Mostrar paginación';
+        },
+        formatRefresh: function () {
+            return 'Refrescar';
+        },
+        formatToggle: function () {
+            return 'Ocultar/Mostrar';
+        },
+        formatColumns: function () {
+            return 'Columnas';
+        },
+        formatAllRows: function () {
+            return 'Todos';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-ES']);
+
+})(jQuery);

File diff suppressed because it is too large
+ 7 - 0
dist/locale/bootstrap-table-es-ES.min.js


+ 21 - 4
docs/_i18n/en/documentation/table-options.md

@@ -126,7 +126,15 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-url</td>
         <td>data-url</td>
         <td>String</td>
         <td>String</td>
         <td>undefined</td>
         <td>undefined</td>
-        <td>A URL to request data from remote site.</td>
+        <td>
+        	A URL to request data from remote site.
+        	<br/>Note that the required server response format is different depending on whether the 'sidePagination'
+        	option is specified. See the following examples:
+        	<ul>
+        		<li><a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data1.json">Without server-side pagination</a></li>
+        		<li><a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data2.json">With server-side pagination</a></li>
+        	</ul>
+        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>cache</td>
         <td>cache</td>
@@ -199,7 +207,16 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-side-pagination</td>
         <td>data-side-pagination</td>
         <td>String</td>
         <td>String</td>
         <td>'client'</td>
         <td>'client'</td>
-        <td>Defines the side pagination of table, can only be 'client' or 'server'. Using 'server' side requires either setting the 'url' or 'ajax' option</td>
+        <td>
+        	Defines the side pagination of table, can only be 'client' or 'server'.
+        	Using 'server' side requires either setting the 'url' or 'ajax' option.
+        	<br/>Note that the required server response format is different depending on whether
+        	the 'client' or 'server' option is specified. See the following examples:
+        	<ul>
+        		<li><a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data1.json">Without server-side pagination</a></li>
+        		<li><a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data2.json">With server-side pagination</a></li>
+        	</ul>
+        </td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>pageNumber</td>
         <td>pageNumber</td>
@@ -444,11 +461,11 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
     <tr>
     <tr>
         <td>toolbar</td>
         <td>toolbar</td>
         <td>data-toolbar</td>
         <td>data-toolbar</td>
-        <td>String</td>
+        <td>String | Node</td>
         <td>undefined</td>
         <td>undefined</td>
         <td>
         <td>
         A jQuery selector that indicates the toolbar, for example:<br>
         A jQuery selector that indicates the toolbar, for example:<br>
-        #toolbar, .toolbar.
+        #toolbar, .toolbar, or a DOM node.
         </td>
         </td>
     </tr>
     </tr>
     <tr>
     <tr>

+ 11 - 4
src/bootstrap-table.css

@@ -41,9 +41,6 @@
 .fixed-table-footer,
 .fixed-table-footer,
 .fixed-table-header {
 .fixed-table-header {
     overflow: hidden;
     overflow: hidden;
-    border-radius: 4px 4px 0 0;
-    -webkit-border-radius: 4px 4px 0 0;
-    -moz-border-radius: 4px 4px 0 0;
 }
 }
 
 
 .fixed-table-footer {
 .fixed-table-footer {
@@ -74,7 +71,8 @@
     -moz-border-radius-topleft: 4px;
     -moz-border-radius-topleft: 4px;
 }
 }
 
 
-.fixed-table-container thead th .th-inner {
+.fixed-table-container thead th .th-inner,
+.fixed-table-container tbody td .th-inner {
     padding: 8px;
     padding: 8px;
     line-height: 24px;
     line-height: 24px;
     vertical-align: top;
     vertical-align: top;
@@ -269,6 +267,15 @@
     margin: 0;
     margin: 0;
 }
 }
 
 
+.bootstrap-table .fixed-table-footer tbody > tr > td {
+    padding: 0 !important;
+}
+
+.bootstrap-table .fixed-table-footer .table {
+    border-bottom: none;
+    border-radius: 0;
+}
+
 .pull-right .dropdown-menu {
 .pull-right .dropdown-menu {
     right: 0;
     right: 0;
     left: auto;
     left: auto;

+ 23 - 12
src/bootstrap-table.js

@@ -897,7 +897,7 @@
 
 
         this.$toolbar.html('');
         this.$toolbar.html('');
 
 
-        if (typeof this.options.toolbar === 'string') {
+        if (typeof this.options.toolbar === 'string' || typeof this.options.toolbar === 'object') {
             $(sprintf('<div class="bars pull-%s"></div>', this.options.toolbarAlign))
             $(sprintf('<div class="bars pull-%s"></div>', this.options.toolbarAlign))
                 .appendTo(this.$toolbar)
                 .appendTo(this.$toolbar)
                 .append($(this.options.toolbar));
                 .append($(this.options.toolbar));
@@ -1025,10 +1025,7 @@
 
 
             if (this.options.searchText !== '') {
             if (this.options.searchText !== '') {
                 $search.val(this.options.searchText);
                 $search.val(this.options.searchText);
-                clearTimeout(timeoutId); // doesn't matter if it's 0
-                timeoutId = setTimeout(function () {
-                    $search.trigger('keyup');
-                }, that.options.searchTimeOut);
+                that.onSearch({currentTarget: $search});
             }
             }
         }
         }
     };
     };
@@ -1826,7 +1823,7 @@
         this.$tableBody.off('scroll').on('scroll', function () {
         this.$tableBody.off('scroll').on('scroll', function () {
             that.$tableHeader.scrollLeft($(this).scrollLeft());
             that.$tableHeader.scrollLeft($(this).scrollLeft());
 
 
-            if (this.options.showFooter && !this.options.cardView) {
+            if (that.options.showFooter && !that.options.cardView) {
                 that.$tableFooter.scrollLeft($(this).scrollLeft());
                 that.$tableFooter.scrollLeft($(this).scrollLeft());
             }
             }
         });
         });
@@ -1843,7 +1840,7 @@
         }
         }
 
 
         if (!this.options.cardView && this.options.detailView) {
         if (!this.options.cardView && this.options.detailView) {
-            html.push('<td></td>');
+            html.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>');
         }
         }
 
 
         $.each(this.columns, function (i, column) {
         $.each(this.columns, function (i, column) {
@@ -1863,8 +1860,13 @@
             style = sprintf('vertical-align: %s; ', column.valign);
             style = sprintf('vertical-align: %s; ', column.valign);
 
 
             html.push('<td', class_, sprintf(' style="%s"', falign + style), '>');
             html.push('<td', class_, sprintf(' style="%s"', falign + style), '>');
+            html.push('<div class="th-inner">');
 
 
             html.push(calculateObjectValue(column, column.footerFormatter, [data], '&nbsp;') || '&nbsp;');
             html.push(calculateObjectValue(column, column.footerFormatter, [data], '&nbsp;') || '&nbsp;');
+
+            html.push('</div>');
+            html.push('<div class="fht-cell"></div>');
+            html.push('</div>');
             html.push('</td>');
             html.push('</td>');
         });
         });
 
 
@@ -1896,8 +1898,10 @@
 
 
         $footerTd = this.$tableFooter.find('td');
         $footerTd = this.$tableFooter.find('td');
 
 
-        this.$tableBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function (i) {
-            $footerTd.eq(i).outerWidth($(this).outerWidth());
+        this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
+            var $this = $(this);
+
+            $footerTd.eq(i).find('.fht-cell').width($this.innerWidth());
         });
         });
     };
     };
 
 
@@ -1987,7 +1991,7 @@
         if (this.options.showFooter) {
         if (this.options.showFooter) {
             this.resetFooter();
             this.resetFooter();
             if (this.options.height) {
             if (this.options.height) {
-                padding += this.$tableFooter.outerHeight();
+                padding += this.$tableFooter.outerHeight() + 1;
             }
             }
         }
         }
 
 
@@ -2076,7 +2080,7 @@
     BootstrapTable.prototype.getRowByUniqueId = function (id) {
     BootstrapTable.prototype.getRowByUniqueId = function (id) {
         var uniqueId = this.options.uniqueId,
         var uniqueId = this.options.uniqueId,
             len = this.options.data.length,
             len = this.options.data.length,
-            dataRow = undefined,
+            dataRow = null,
             i, row;
             i, row;
 
 
         for (i = len - 1; i >= 0; i--) {
         for (i = len - 1; i >= 0; i--) {
@@ -2417,6 +2421,12 @@
         this.init();
         this.init();
     };
     };
 
 
+    BootstrapTable.prototype.resetSearch = function (text) {
+        var $search = this.$toolbar.find('.search input');
+        $search.val(text || '');
+        this.onSearch({currentTarget: $search});
+    };
+
     // BOOTSTRAP TABLE PLUGIN DEFINITION
     // BOOTSTRAP TABLE PLUGIN DEFINITION
     // =======================
     // =======================
 
 
@@ -2442,7 +2452,8 @@
         'selectPage', 'prevPage', 'nextPage',
         'selectPage', 'prevPage', 'nextPage',
         'togglePagination',
         'togglePagination',
         'toggleView',
         'toggleView',
-        'refreshOptions'
+        'refreshOptions',
+        'resetSearch'
     ];
     ];
 
 
     $.fn.bootstrapTable = function (option) {
     $.fn.bootstrapTable = function (option) {

+ 3 - 0
src/extensions/angular/bootstrap-table-angular.js

@@ -1,5 +1,8 @@
 // JavaScript source code
 // JavaScript source code
 (function () {
 (function () {
+  if (typeof angular === 'undefined') {
+    return;
+  }
   angular.module('bsTable', []).directive('bsTableControl', function () {
   angular.module('bsTable', []).directive('bsTableControl', function () {
     var CONTAINER_SELECTOR = '.bootstrap-table';
     var CONTAINER_SELECTOR = '.bootstrap-table';
     var SCROLLABLE_SELECTOR = '.fixed-table-body';
     var SCROLLABLE_SELECTOR = '.fixed-table-body';

+ 1 - 1
src/extensions/group-by/bootstrap-table-group-by.js

@@ -93,7 +93,7 @@
 
 
     var groupBy = function (array , f) {
     var groupBy = function (array , f) {
        var groups = {};
        var groups = {};
-       array.forEach(function(o) {
+       $.each(array, function(i, o) {
            var group = JSON.stringify(f(o));
            var group = JSON.stringify(f(o));
            groups[group] = groups[group] || [];
            groups[group] = groups[group] || [];
            groups[group].push(o);
            groups[group].push(o);

+ 1 - 1
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -328,7 +328,7 @@
         var $multiSortName = this.$sortModal.find('.multi-sort-name').last(),
         var $multiSortName = this.$sortModal.find('.multi-sort-name').last(),
             $multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
             $multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
 
 
-        this.columns.forEach(function(column) {
+        $.each(this.columns, function (i, column) {
             if (column.sortable === false || column.visible === false) {
             if (column.sortable === false || column.visible === false) {
                 return true;
                 return true;
             }
             }

+ 4 - 4
src/extensions/reorder-rows/bootstrap-table-reorder-rows.js

@@ -44,8 +44,6 @@
 
 
     BootstrapTable.prototype.init = function () {
     BootstrapTable.prototype.init = function () {
 
 
-        _init.apply(this, Array.prototype.slice.apply(arguments));
-
         if (!this.options.reorderableRows) {
         if (!this.options.reorderableRows) {
             return;
             return;
         }
         }
@@ -62,6 +60,8 @@
                 onPostBody.apply();
                 onPostBody.apply();
             }, 1);
             }, 1);
         };
         };
+
+        _init.apply(this, Array.prototype.slice.apply(arguments));
     };
     };
 
 
     BootstrapTable.prototype.initSearch = function () {
     BootstrapTable.prototype.initSearch = function () {
@@ -91,7 +91,7 @@
         });
         });
     };
     };
 
 
-    BootstrapTable.prototype.onDrop = function (table, row) {
+    BootstrapTable.prototype.onDrop = function (table, droppedRow) {
         var tableBs = $(table),
         var tableBs = $(table),
             tableBsData = tableBs.data('bootstrap.table'),
             tableBsData = tableBs.data('bootstrap.table'),
             tableBsOptions = tableBs.data('bootstrap.table').options,
             tableBsOptions = tableBs.data('bootstrap.table').options,
@@ -107,7 +107,7 @@
         tableBsOptions.data = newData;
         tableBsOptions.data = newData;
 
 
         //Call the user defined function
         //Call the user defined function
-        tableBsOptions.onReorderRowsDrop.apply(table, row);
+        tableBsOptions.onReorderRowsDrop.apply(table, [table, droppedRow]);
 
 
         //Call the event reorder-row
         //Call the event reorder-row
         tableBsData.trigger('reorder-row', newData);
         tableBsData.trigger('reorder-row', newData);

+ 43 - 0
src/locale/bootstrap-table-ca-ES.js

@@ -0,0 +1,43 @@
+/**
+ * Bootstrap Table Catalan translation
+ * Author: Marc Pina<iwalkalone69@gmail.com>
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['ca-ES'] = {
+        formatLoadingMessage: function () {
+            return 'Si us plau esperi...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' resultats per pàgina';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Mostrant de ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats';
+        },
+        formatSearch: function () {
+            return 'Buscar';
+        },
+        formatNoMatches: function () {
+            return 'No s\'han trobat resultats';
+        },
+        formatPaginationSwitch: function () {
+            return 'Amagar/Mostrar paginació';
+        },
+        formatRefresh: function () {
+            return 'Refrescar';
+        },
+        formatToggle: function () {
+            return 'Amagar/Mostrar';
+        },
+        formatColumns: function () {
+            return 'Columnes';
+        },
+        formatAllRows: function () {
+            return 'Tots';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ca-ES']);
+
+})(jQuery);

+ 43 - 0
src/locale/bootstrap-table-es-ES.js

@@ -0,0 +1,43 @@
+/**
+ * Bootstrap Table Spanish Spain translation
+ * Author: Marc Pina<iwalkalone69@gmail.com>
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['es-ES'] = {
+        formatLoadingMessage: function () {
+            return 'Por favor espere...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' resultados por página';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Mostrando desde ' + pageFrom + ' hasta ' + pageTo + ' - En total ' + totalRows + ' resultados';
+        },
+        formatSearch: function () {
+            return 'Buscar';
+        },
+        formatNoMatches: function () {
+            return 'No se encontraron resultados';
+        },
+        formatPaginationSwitch: function () {
+            return 'Ocultar/Mostrar paginación';
+        },
+        formatRefresh: function () {
+            return 'Refrescar';
+        },
+        formatToggle: function () {
+            return 'Ocultar/Mostrar';
+        },
+        formatColumns: function () {
+            return 'Columnas';
+        },
+        formatAllRows: function () {
+            return 'Todos';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-ES']);
+
+})(jQuery);

+ 44 - 0
src/locale/bootstrap-table-hr-HR.js

@@ -0,0 +1,44 @@
+/**
+ * Bootstrap Table Croatian translation
+ * Author: Petra Štrbenac (petra.strbenac@gmail.com)
+ * Author: Petra Štrbenac (petra.strbenac@gmail.com)
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['hr-HR'] = {
+        formatLoadingMessage: function () {
+            return 'Molimo pričekajte ...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' broj zapisa po stranici';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Prikazujem ' + pageFrom + '. - ' + pageTo + '. od ukupnog broja zapisa ' + totalRows;
+        },
+        formatSearch: function () {
+            return 'Pretraži';
+        },
+        formatNoMatches: function () {
+            return 'Nije pronađen niti jedan zapis';
+        },
+        formatPaginationSwitch: function () {
+            return 'Prikaži/sakrij stranice';
+        },
+        formatRefresh: function () {
+            return 'Osvježi';
+        },
+        formatToggle: function () {
+            return 'Promijeni prikaz';
+        },
+        formatColumns: function () {
+            return 'Kolone';
+        },
+        formatAllRows: function () {
+            return 'Sve';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['hr-HR']);
+
+})(jQuery);