bootstrap-table-rails 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 188a4c8cd1cc66093bd4bde072de922ccb2843e6
4
- data.tar.gz: 44a42b9fd49db52766748b6d67389340d8848c23
3
+ metadata.gz: 5b2599acfe26dc2954e8237a3f8f82d811a46f5e
4
+ data.tar.gz: e64ee44294cea745e55b4f5b77759a167c629e01
5
5
  SHA512:
6
- metadata.gz: 3ad963230c5845be7b2ea5236ddced1f1679448990675f0fd7a34d53fcda56e5789d3cef732a7398f36463924984d9daf8e890d7cbe4c99e9090c5ef16b7dcc9
7
- data.tar.gz: 889ebafec39cf2eaf5a0a6f239e521f206e5f1e278d171060177b847bd26f2984cbf93e6814ee88a74ad2e72f4f75f38b52a1ca9625f53a4ee4db920365fadd5
6
+ metadata.gz: 0e4fd7b855837ceb4cd916fbc569cabd7539dc1a57e1ce0556c081c67dd70e684bfdd8b0980ff7d4ed13a348ba79b65b03f98b5b36bb53e4b3ac0a72d38b6965
7
+ data.tar.gz: 3d1d08724a9b23695d883568a92489049f77ac3a092c6cac5f6888ed96662e2d8618e51c2592f037706183b5c021f534b52f76cc663edb086519cd05f42a9381
@@ -1,7 +1,7 @@
1
1
  module Bootstrap
2
2
  module Table
3
3
  module Rails
4
- VERSION = "1.9.0"
4
+ VERSION = "1.9.1"
5
5
  end
6
6
  end
7
7
  end
@@ -795,6 +795,7 @@
795
795
  /**
796
796
  * Bootstrap Table Italian translation
797
797
  * Author: Davide Renzi<davide.renzi@gmail.com>
798
+ * Author: Davide Borsatto <davide.borsatto@gmail.com>
798
799
  */
799
800
  (function ($) {
800
801
  'use strict';
@@ -804,7 +805,7 @@
804
805
  return 'Caricamento in corso...';
805
806
  },
806
807
  formatRecordsPerPage: function (pageNumber) {
807
- return pageNumber + ' records per pagina';
808
+ return pageNumber + ' elementi per pagina';
808
809
  },
809
810
  formatShowingRows: function (pageFrom, pageTo, totalRows) {
810
811
  return 'Pagina ' + pageFrom + ' di ' + pageTo + ' (' + totalRows + ' records)';
@@ -813,13 +814,13 @@
813
814
  return 'Cerca';
814
815
  },
815
816
  formatNoMatches: function () {
816
- return 'Nessun record trovato';
817
+ return 'Nessun elemento trovato';
817
818
  },
818
819
  formatRefresh: function () {
819
- return 'Rinfrescare';
820
+ return 'Aggiorna';
820
821
  },
821
822
  formatToggle: function () {
822
- return 'Alternare';
823
+ return 'Alterna';
823
824
  },
824
825
  formatColumns: function () {
825
826
  return 'Colonne';
@@ -864,6 +865,9 @@
864
865
  },
865
866
  formatColumns: function () {
866
867
  return '列';
868
+ },
869
+ formatAllRows: function () {
870
+ return 'すべて';
867
871
  }
868
872
  };
869
873
 
@@ -982,6 +986,9 @@
982
986
  },
983
987
  formatColumns: function () {
984
988
  return 'Lajur';
989
+ },
990
+ formatAllRows: function () {
991
+ return 'Semua';
985
992
  }
986
993
  };
987
994
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @author zhixin wen <wenzhixin2010@gmail.com>
3
- * version: 1.9.0
3
+ * version: 1.9.1
4
4
  * https://github.com/wenzhixin/bootstrap-table/
5
5
  */
6
6
 
@@ -263,6 +263,7 @@
263
263
  return res;
264
264
  },
265
265
  pagination: false,
266
+ onlyInfoPagination: false,
266
267
  sidePagination: 'client', // client or server
267
268
  totalRows: 0, // server side need to set
268
269
  pageNumber: 1,
@@ -415,6 +416,9 @@
415
416
  formatShowingRows: function (pageFrom, pageTo, totalRows) {
416
417
  return sprintf('Showing %s to %s of %s rows', pageFrom, pageTo, totalRows);
417
418
  },
419
+ formatDetailPagination: function (totalRows) {
420
+ return sprintf('Showing %s rows', totalRows);
421
+ },
418
422
  formatSearch: function () {
419
423
  return 'Search';
420
424
  },
@@ -577,7 +581,7 @@
577
581
  columns = [],
578
582
  data = [];
579
583
 
580
- this.$header = this.$el.find('thead');
584
+ this.$header = this.$el.find('>thead');
581
585
  if (!this.$header.length) {
582
586
  this.$header = $('<thead></thead>').appendTo(this.$el);
583
587
  }
@@ -619,7 +623,7 @@
619
623
  return;
620
624
  }
621
625
 
622
- this.$el.find('tbody tr').each(function () {
626
+ this.$el.find('>tbody>tr').each(function () {
623
627
  var row = {};
624
628
 
625
629
  // save tr's id, class and data-* attributes
@@ -790,6 +794,7 @@
790
794
  .on('click', '[name="btSelectAll"]', function () {
791
795
  var checked = $(this).prop('checked');
792
796
  that[checked ? 'checkAll' : 'uncheckAll']();
797
+ that.updateSelected();
793
798
  });
794
799
  };
795
800
 
@@ -945,14 +950,18 @@
945
950
  }
946
951
 
947
952
  if (this.options.showRefresh) {
948
- html.push(sprintf('<button class="btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" name="refresh" title="%s">',
953
+ html.push(sprintf('<button class="btn btn-default' +
954
+ sprintf(' btn-%s', this.options.iconSize) +
955
+ '" type="button" name="refresh" title="%s">',
949
956
  this.options.formatRefresh()),
950
957
  sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),
951
958
  '</button>');
952
959
  }
953
960
 
954
961
  if (this.options.showToggle) {
955
- html.push(sprintf('<button class="btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" name="toggle" title="%s">',
962
+ html.push(sprintf('<button class="btn btn-default' +
963
+ sprintf(' btn-%s', this.options.iconSize) +
964
+ '" type="button" name="toggle" title="%s">',
956
965
  this.options.formatToggle()),
957
966
  sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),
958
967
  '</button>');
@@ -961,7 +970,9 @@
961
970
  if (this.options.showColumns) {
962
971
  html.push(sprintf('<div class="keep-open btn-group" title="%s">',
963
972
  this.options.formatColumns()),
964
- '<button type="button" class="btn btn-default' + (this.options.iconSize == undefined ? '' : ' btn-' + this.options.iconSize) + ' dropdown-toggle" data-toggle="dropdown">',
973
+ '<button type="button" class="btn btn-default' +
974
+ sprintf(' btn-%s', this.options.iconSize) +
975
+ ' dropdown-toggle" data-toggle="dropdown">',
965
976
  sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.columns),
966
977
  ' <span class="caret"></span>',
967
978
  '</button>',
@@ -1036,7 +1047,9 @@
1036
1047
  html = [];
1037
1048
  html.push(
1038
1049
  '<div class="pull-' + this.options.searchAlign + ' search">',
1039
- sprintf('<input class="form-control' + (this.options.iconSize === undefined ? '' : ' input-' + this.options.iconSize) + '" type="text" placeholder="%s">',
1050
+ sprintf('<input class="form-control' +
1051
+ sprintf(' input-%s', this.options.iconSize) +
1052
+ '" type="text" placeholder="%s">',
1040
1053
  this.options.formatSearch()),
1041
1054
  '</div>');
1042
1055
 
@@ -1080,7 +1093,11 @@
1080
1093
  // Check filter
1081
1094
  this.data = f ? $.grep(this.options.data, function (item, i) {
1082
1095
  for (var key in f) {
1083
- if (item[key] !== f[key]) {
1096
+ if ($.isArray(f[key])) {
1097
+ if ($.inArray(item[key], f[key]) === -1) {
1098
+ return false;
1099
+ }
1100
+ } else if (item[key] !== f[key]) {
1084
1101
  return false;
1085
1102
  }
1086
1103
  }
@@ -1151,7 +1168,7 @@
1151
1168
  var pageLst = typeof this.options.pageList === 'string' ?
1152
1169
  this.options.pageList.replace('[', '').replace(']', '')
1153
1170
  .replace(/ /g, '').toLowerCase().split(',') : this.options.pageList;
1154
- if (pageLst.indexOf(this.options.formatAllRows().toLowerCase()) > -1) {
1171
+ if ($.inArray(this.options.formatAllRows().toLowerCase(), pageLst) > -1) {
1155
1172
  $allSelected = true;
1156
1173
  }
1157
1174
  }
@@ -1173,124 +1190,129 @@
1173
1190
  html.push(
1174
1191
  '<div class="pull-' + this.options.paginationDetailHAlign + ' pagination-detail">',
1175
1192
  '<span class="pagination-info">',
1193
+ this.options.onlyInfoPagination ? this.options.formatDetailPagination(this.options.totalRows) :
1176
1194
  this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),
1177
1195
  '</span>');
1178
1196
 
1179
- html.push('<span class="page-list">');
1180
-
1181
- var pageNumber = [
1182
- sprintf('<span class="btn-group %s">',
1183
- this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
1184
- 'dropdown' : 'dropup'),
1185
- '<button type="button" class="btn btn-default ' +
1186
- (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) +
1187
- ' dropdown-toggle" data-toggle="dropdown">',
1188
- '<span class="page-size">',
1189
- $allSelected ? this.options.formatAllRows() : this.options.pageSize,
1190
- '</span>',
1191
- ' <span class="caret"></span>',
1192
- '</button>',
1193
- '<ul class="dropdown-menu" role="menu">'
1194
- ],
1195
- pageList = this.options.pageList;
1196
-
1197
- if (typeof this.options.pageList === 'string') {
1198
- var list = this.options.pageList.replace('[', '').replace(']', '')
1199
- .replace(/ /g, '').split(',');
1200
-
1201
- pageList = [];
1202
- $.each(list, function (i, value) {
1203
- pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
1204
- that.options.formatAllRows() : +value);
1205
- });
1206
- }
1197
+ if (!this.options.onlyInfoPagination) {
1198
+ html.push('<span class="page-list">');
1199
+
1200
+ var pageNumber = [
1201
+ sprintf('<span class="btn-group %s">',
1202
+ this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
1203
+ 'dropdown' : 'dropup'),
1204
+ '<button type="button" class="btn btn-default ' +
1205
+ sprintf(' btn-%s', this.options.iconSize) +
1206
+ ' dropdown-toggle" data-toggle="dropdown">',
1207
+ '<span class="page-size">',
1208
+ $allSelected ? this.options.formatAllRows() : this.options.pageSize,
1209
+ '</span>',
1210
+ ' <span class="caret"></span>',
1211
+ '</button>',
1212
+ '<ul class="dropdown-menu" role="menu">'
1213
+ ],
1214
+ pageList = this.options.pageList;
1215
+
1216
+ if (typeof this.options.pageList === 'string') {
1217
+ var list = this.options.pageList.replace('[', '').replace(']', '')
1218
+ .replace(/ /g, '').split(',');
1219
+
1220
+ pageList = [];
1221
+ $.each(list, function (i, value) {
1222
+ pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
1223
+ that.options.formatAllRows() : +value);
1224
+ });
1225
+ }
1207
1226
 
1208
- $.each(pageList, function (i, page) {
1209
- if (!that.options.smartDisplay || i === 0 || pageList[i - 1] <= that.options.totalRows) {
1210
- var active;
1211
- if ($allSelected) {
1212
- active = page === that.options.formatAllRows() ? ' class="active"' : '';
1213
- } else {
1214
- active = page === that.options.pageSize ? ' class="active"' : '';
1227
+ $.each(pageList, function (i, page) {
1228
+ if (!that.options.smartDisplay || i === 0 || pageList[i - 1] <= that.options.totalRows) {
1229
+ var active;
1230
+ if ($allSelected) {
1231
+ active = page === that.options.formatAllRows() ? ' class="active"' : '';
1232
+ } else {
1233
+ active = page === that.options.pageSize ? ' class="active"' : '';
1234
+ }
1235
+ pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
1215
1236
  }
1216
- pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
1217
- }
1218
- });
1219
- pageNumber.push('</ul></span>');
1237
+ });
1238
+ pageNumber.push('</ul></span>');
1220
1239
 
1221
- html.push(this.options.formatRecordsPerPage(pageNumber.join('')));
1222
- html.push('</span>');
1240
+ html.push(this.options.formatRecordsPerPage(pageNumber.join('')));
1241
+ html.push('</span>');
1223
1242
 
1224
- html.push('</div>',
1225
- '<div class="pull-' + this.options.paginationHAlign + ' pagination">',
1226
- '<ul class="pagination' + (this.options.iconSize === undefined ? '' : ' pagination-' + this.options.iconSize) + '">',
1227
- '<li class="page-first"><a href="javascript:void(0)">' + this.options.paginationFirstText + '</a></li>',
1228
- '<li class="page-pre"><a href="javascript:void(0)">' + this.options.paginationPreText + '</a></li>');
1243
+ html.push('</div>',
1244
+ '<div class="pull-' + this.options.paginationHAlign + ' pagination">',
1245
+ '<ul class="pagination' + sprintf(' pagination-%s', this.options.iconSize) + '">',
1246
+ '<li class="page-first"><a href="javascript:void(0)">' + this.options.paginationFirstText + '</a></li>',
1247
+ '<li class="page-pre"><a href="javascript:void(0)">' + this.options.paginationPreText + '</a></li>');
1229
1248
 
1230
- if (this.totalPages < 5) {
1231
- from = 1;
1232
- to = this.totalPages;
1233
- } else {
1234
- from = this.options.pageNumber - 2;
1235
- to = from + 4;
1236
- if (from < 1) {
1249
+ if (this.totalPages < 5) {
1237
1250
  from = 1;
1238
- to = 5;
1239
- }
1240
- if (to > this.totalPages) {
1241
1251
  to = this.totalPages;
1242
- from = to - 4;
1252
+ } else {
1253
+ from = this.options.pageNumber - 2;
1254
+ to = from + 4;
1255
+ if (from < 1) {
1256
+ from = 1;
1257
+ to = 5;
1258
+ }
1259
+ if (to > this.totalPages) {
1260
+ to = this.totalPages;
1261
+ from = to - 4;
1262
+ }
1263
+ }
1264
+ for (i = from; i <= to; i++) {
1265
+ html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
1266
+ '<a href="javascript:void(0)">', i, '</a>',
1267
+ '</li>');
1243
1268
  }
1244
- }
1245
- for (i = from; i <= to; i++) {
1246
- html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
1247
- '<a href="javascript:void(0)">', i, '</a>',
1248
- '</li>');
1249
- }
1250
1269
 
1251
- html.push(
1252
- '<li class="page-next"><a href="javascript:void(0)">' + this.options.paginationNextText + '</a></li>',
1253
- '<li class="page-last"><a href="javascript:void(0)">' + this.options.paginationLastText + '</a></li>',
1254
- '</ul>',
1255
- '</div>');
1270
+ html.push(
1271
+ '<li class="page-next"><a href="javascript:void(0)">' + this.options.paginationNextText + '</a></li>',
1272
+ '<li class="page-last"><a href="javascript:void(0)">' + this.options.paginationLastText + '</a></li>',
1273
+ '</ul>',
1274
+ '</div>');
1256
1275
 
1276
+ }
1257
1277
  this.$pagination.html(html.join(''));
1258
1278
 
1259
- $pageList = this.$pagination.find('.page-list a');
1260
- $first = this.$pagination.find('.page-first');
1261
- $pre = this.$pagination.find('.page-pre');
1262
- $next = this.$pagination.find('.page-next');
1263
- $last = this.$pagination.find('.page-last');
1264
- $number = this.$pagination.find('.page-number');
1279
+ if (!this.options.onlyInfoPagination) {
1280
+ $pageList = this.$pagination.find('.page-list a');
1281
+ $first = this.$pagination.find('.page-first');
1282
+ $pre = this.$pagination.find('.page-pre');
1283
+ $next = this.$pagination.find('.page-next');
1284
+ $last = this.$pagination.find('.page-last');
1285
+ $number = this.$pagination.find('.page-number');
1286
+
1287
+ if (this.options.pageNumber <= 1) {
1288
+ $first.addClass('disabled');
1289
+ $pre.addClass('disabled');
1290
+ }
1291
+ if (this.options.pageNumber >= this.totalPages) {
1292
+ $next.addClass('disabled');
1293
+ $last.addClass('disabled');
1294
+ }
1295
+ if (this.options.smartDisplay) {
1296
+ if (this.totalPages <= 1) {
1297
+ this.$pagination.find('div.pagination').hide();
1298
+ }
1299
+ if (pageList.length < 2 || this.options.totalRows <= pageList[0]) {
1300
+ this.$pagination.find('span.page-list').hide();
1301
+ }
1265
1302
 
1266
- if (this.options.pageNumber <= 1) {
1267
- $first.addClass('disabled');
1268
- $pre.addClass('disabled');
1269
- }
1270
- if (this.options.pageNumber >= this.totalPages) {
1271
- $next.addClass('disabled');
1272
- $last.addClass('disabled');
1273
- }
1274
- if (this.options.smartDisplay) {
1275
- if (this.totalPages <= 1) {
1276
- this.$pagination.find('div.pagination').hide();
1303
+ // when data is empty, hide the pagination
1304
+ this.$pagination[this.getData().length ? 'show' : 'hide']();
1277
1305
  }
1278
- if (pageList.length < 2 || this.options.totalRows <= pageList[0]) {
1279
- this.$pagination.find('span.page-list').hide();
1306
+ if ($allSelected) {
1307
+ this.options.pageSize = this.options.formatAllRows();
1280
1308
  }
1281
-
1282
- // when data is empty, hide the pagination
1283
- this.$pagination[this.getData().length ? 'show' : 'hide']();
1309
+ $pageList.off('click').on('click', $.proxy(this.onPageListChange, this));
1310
+ $first.off('click').on('click', $.proxy(this.onPageFirst, this));
1311
+ $pre.off('click').on('click', $.proxy(this.onPagePre, this));
1312
+ $next.off('click').on('click', $.proxy(this.onPageNext, this));
1313
+ $last.off('click').on('click', $.proxy(this.onPageLast, this));
1314
+ $number.off('click').on('click', $.proxy(this.onPageNumber, this));
1284
1315
  }
1285
- if ($allSelected) {
1286
- this.options.pageSize = this.options.formatAllRows();
1287
- }
1288
- $pageList.off('click').on('click', $.proxy(this.onPageListChange, this));
1289
- $first.off('click').on('click', $.proxy(this.onPageFirst, this));
1290
- $pre.off('click').on('click', $.proxy(this.onPagePre, this));
1291
- $next.off('click').on('click', $.proxy(this.onPageNext, this));
1292
- $last.off('click').on('click', $.proxy(this.onPageLast, this));
1293
- $number.off('click').on('click', $.proxy(this.onPageNumber, this));
1294
1316
  };
1295
1317
 
1296
1318
  BootstrapTable.prototype.updatePagination = function (event) {
@@ -1359,7 +1381,7 @@
1359
1381
 
1360
1382
  this.trigger('pre-body', data);
1361
1383
 
1362
- this.$body = this.$el.find('tbody');
1384
+ this.$body = this.$el.find('>tbody');
1363
1385
  if (!this.$body.length) {
1364
1386
  this.$body = $('<tbody></tbody>').appendTo(this.$el);
1365
1387
  }
@@ -1523,7 +1545,8 @@
1523
1545
 
1524
1546
  // Hide empty data on Card view when smartDisplay is set to true.
1525
1547
  if (that.options.cardView && that.options.smartDisplay && value === '') {
1526
- text = '';
1548
+ // Should set a placeholder for event binding correct fieldIndex
1549
+ text = '<div class="card-view"></div>';
1527
1550
  }
1528
1551
  }
1529
1552
 
@@ -1642,7 +1665,7 @@
1642
1665
  }
1643
1666
 
1644
1667
  for (var key in events) {
1645
- that.$body.find('tr').each(function () {
1668
+ that.$body.find('>tr:not(.no-records-found)').each(function () {
1646
1669
  var $tr = $(this),
1647
1670
  $td = $tr.find(that.options.cardView ? '.card-view' : 'td').eq(fieldIndex),
1648
1671
  index = key.indexOf(' '),
@@ -1868,7 +1891,7 @@
1868
1891
 
1869
1892
  var visibleFields = this.getVisibleFields();
1870
1893
 
1871
- this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
1894
+ this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {
1872
1895
  var $this = $(this),
1873
1896
  index = i;
1874
1897
 
@@ -1962,7 +1985,7 @@
1962
1985
 
1963
1986
  $footerTd = this.$tableFooter.find('td');
1964
1987
 
1965
- this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
1988
+ this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {
1966
1989
  var $this = $(this);
1967
1990
 
1968
1991
  $footerTd.eq(i).find('.fht-cell').width($this.innerWidth());
@@ -2148,26 +2171,30 @@
2148
2171
  var uniqueId = this.options.uniqueId,
2149
2172
  len = this.options.data.length,
2150
2173
  dataRow = null,
2151
- i, row;
2174
+ i, row, rowUniqueId;
2152
2175
 
2153
2176
  for (i = len - 1; i >= 0; i--) {
2154
2177
  row = this.options.data[i];
2155
2178
 
2156
- if (!row.hasOwnProperty(uniqueId)) {
2179
+ if (row.hasOwnProperty(uniqueId)) { // uniqueId is a column
2180
+ rowUniqueId = row[uniqueId];
2181
+ } else if(row._data.hasOwnProperty(uniqueId)) { // uniqueId is a row data property
2182
+ rowUniqueId = row._data[uniqueId];
2183
+ } else {
2157
2184
  continue;
2158
2185
  }
2159
2186
 
2160
- if (typeof row[uniqueId] === 'string') {
2187
+ if (typeof rowUniqueId === 'string') {
2161
2188
  id = id.toString();
2162
- } else if (typeof row[uniqueId] === 'number') {
2163
- if ((Number(row[uniqueId]) === row[uniqueId]) && (row[uniqueId] % 1 === 0)) {
2189
+ } else if (typeof rowUniqueId === 'number') {
2190
+ if ((Number(rowUniqueId) === rowUniqueId) && (rowUniqueId % 1 === 0)) {
2164
2191
  id = parseInt(id);
2165
- } else if ((row[uniqueId] === Number(row[uniqueId])) && (row[uniqueId] !== 0)) {
2192
+ } else if ((rowUniqueId === Number(rowUniqueId)) && (rowUniqueId !== 0)) {
2166
2193
  id = parseFloat(id);
2167
2194
  }
2168
2195
  }
2169
2196
 
2170
- if (row[uniqueId] === id) {
2197
+ if (rowUniqueId === id) {
2171
2198
  dataRow = row;
2172
2199
  break;
2173
2200
  }
@@ -2193,6 +2220,24 @@
2193
2220
  this.initBody(true);
2194
2221
  };
2195
2222
 
2223
+ BootstrapTable.prototype.updateByUniqueId = function (params) {
2224
+ var rowId;
2225
+
2226
+ if (!params.hasOwnProperty('id') || !params.hasOwnProperty('row')) {
2227
+ return;
2228
+ }
2229
+
2230
+ rowId = $.inArray(this.getRowByUniqueId(params.id), this.options.data);
2231
+
2232
+ if (rowId === -1) {
2233
+ return;
2234
+ }
2235
+
2236
+ $.extend(this.data[rowId], params.row);
2237
+ this.initSort();
2238
+ this.initBody(true);
2239
+ };
2240
+
2196
2241
  BootstrapTable.prototype.insertRow = function (params) {
2197
2242
  if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
2198
2243
  return;
@@ -2244,14 +2289,14 @@
2244
2289
  rowspan = options.rowspan || 1,
2245
2290
  colspan = options.colspan || 1,
2246
2291
  i, j,
2247
- $tr = this.$body.find('tr'),
2292
+ $tr = this.$body.find('>tr'),
2248
2293
  $td;
2249
2294
 
2250
2295
  if (this.options.detailView && !this.options.cardView) {
2251
2296
  col += 1;
2252
2297
  }
2253
2298
 
2254
- $td = $tr.eq(row).find('td').eq(col);
2299
+ $td = $tr.eq(row).find('>td').eq(col);
2255
2300
 
2256
2301
  if (row < 0 || col < 0 || row >= this.data.length) {
2257
2302
  return;
@@ -2259,7 +2304,7 @@
2259
2304
 
2260
2305
  for (i = row; i < row + rowspan; i++) {
2261
2306
  for (j = col; j < col + colspan; j++) {
2262
- $tr.eq(i).find('td').eq(j).hide();
2307
+ $tr.eq(i).find('>td').eq(j).hide();
2263
2308
  }
2264
2309
  }
2265
2310
 
@@ -2328,10 +2373,10 @@
2328
2373
  };
2329
2374
 
2330
2375
  BootstrapTable.prototype.check_ = function (checked, index) {
2331
- this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
2376
+ var $el = this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
2332
2377
  this.data[index][this.header.stateField] = checked;
2333
2378
  this.updateSelected();
2334
- this.trigger(checked ? 'check' : 'uncheck', this.data[index]);
2379
+ this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
2335
2380
  };
2336
2381
 
2337
2382
  BootstrapTable.prototype.checkBy = function (obj) {
@@ -2354,11 +2399,11 @@
2354
2399
  return false;
2355
2400
  }
2356
2401
  if ($.inArray(row[obj.field], obj.values) !== -1) {
2357
- that.$selectItem.filter(':enabled')
2402
+ var $el = that.$selectItem.filter(':enabled')
2358
2403
  .filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
2359
2404
  row[that.header.stateField] = checked;
2360
2405
  rows.push(row);
2361
- that.trigger(checked ? 'check' : 'uncheck', row);
2406
+ that.trigger(checked ? 'check' : 'uncheck', row, $el);
2362
2407
  }
2363
2408
  });
2364
2409
  this.updateSelected();
@@ -2566,7 +2611,7 @@
2566
2611
  'getOptions',
2567
2612
  'getSelections', 'getAllSelections', 'getData',
2568
2613
  'load', 'append', 'prepend', 'remove', 'removeAll',
2569
- 'insertRow', 'updateRow', 'updateCell', 'removeByUniqueId',
2614
+ 'insertRow', 'updateRow', 'updateCell', 'updateByUniqueId', 'removeByUniqueId',
2570
2615
  'getRowByUniqueId', 'showRow', 'hideRow', 'getRowsHidden',
2571
2616
  'mergeCells',
2572
2617
  'checkAll', 'uncheckAll',
@@ -244,9 +244,9 @@
244
244
  searchTextCookie = getCookie(this, this.options.cookieIdTable, cookieIds.searchText);
245
245
 
246
246
  //sortOrder
247
- this.options.sortOrder = sortOrderCookie ? sortOrderCookie : 'asc';
247
+ this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder;
248
248
  //sortName
249
- this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : undefined;
249
+ this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName;
250
250
  //pageNumber
251
251
  this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber;
252
252
  //pageSize
@@ -313,7 +313,7 @@
313
313
 
314
314
  BootstrapTable.prototype.selectPage = function (page) {
315
315
  _selectPage.apply(this, Array.prototype.slice.apply(arguments));
316
- setCookie(this, idsStateSaveList.pageNumber, page);
316
+ setCookie(this, cookieIds.pageNumber, page);
317
317
  };
318
318
 
319
319
  BootstrapTable.prototype.onSearch = function () {
@@ -14,8 +14,8 @@
14
14
  txt: 'TXT',
15
15
  sql: 'SQL',
16
16
  doc: 'MS-Word',
17
- excel: 'Ms-Excel',
18
- powerpoint: 'Ms-Powerpoint',
17
+ excel: 'MS-Excel',
18
+ powerpoint: 'MS-Powerpoint',
19
19
  pdf: 'PDF'
20
20
  };
21
21
 
@@ -83,12 +83,11 @@
83
83
  };
84
84
 
85
85
  if (that.options.exportDataType === 'all' && that.options.pagination) {
86
- that.togglePagination();
87
- that.$el.on('load-success.bs.table', function () {
86
+ that.$el.one('load-success.bs.table page-change.bs.table', function () {
88
87
  doExport();
89
- that.$el.off('load-success.bs.table');
90
88
  that.togglePagination();
91
89
  });
90
+ that.togglePagination();
92
91
  } else if (that.options.exportDataType === 'selected') {
93
92
  var data = that.getData(),
94
93
  selectedData = that.getAllSelections();
@@ -374,10 +374,10 @@
374
374
  that.header.formatters[$.inArray(key, that.header.fields)],
375
375
  [value, item, i], value);
376
376
 
377
- if(thisColumn.filterStrictSearch===true){
377
+ if(thisColumn.filterStrictSearch){
378
378
  if (!($.inArray(key, that.header.fields) !== -1 &&
379
379
  (typeof value === 'string' || typeof value === 'number') &&
380
- value.toLowerCase() === fval.toLowerCase())) {
380
+ value.toString().toLowerCase() === fval.toString().toLowerCase())) {
381
381
  return false;
382
382
  }
383
383
  }
@@ -22,7 +22,9 @@
22
22
 
23
23
  var resetView = function (that) {
24
24
  if (that.options.height || that.options.showFooter) {
25
- setTimeout(that.resetView, 1);
25
+ setTimeout(function(){
26
+ that.resetView.call(that);
27
+ }, 1);
26
28
  }
27
29
  };
28
30
 
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Bootstrap Table Italian translation
3
3
  * Author: Davide Renzi<davide.renzi@gmail.com>
4
+ * Author: Davide Borsatto <davide.borsatto@gmail.com>
4
5
  */
5
6
  (function ($) {
6
7
  'use strict';
@@ -10,7 +11,7 @@
10
11
  return 'Caricamento in corso...';
11
12
  },
12
13
  formatRecordsPerPage: function (pageNumber) {
13
- return pageNumber + ' records per pagina';
14
+ return pageNumber + ' elementi per pagina';
14
15
  },
15
16
  formatShowingRows: function (pageFrom, pageTo, totalRows) {
16
17
  return 'Pagina ' + pageFrom + ' di ' + pageTo + ' (' + totalRows + ' records)';
@@ -19,13 +20,13 @@
19
20
  return 'Cerca';
20
21
  },
21
22
  formatNoMatches: function () {
22
- return 'Nessun record trovato';
23
+ return 'Nessun elemento trovato';
23
24
  },
24
25
  formatRefresh: function () {
25
- return 'Rinfrescare';
26
+ return 'Aggiorna';
26
27
  },
27
28
  formatToggle: function () {
28
- return 'Alternare';
29
+ return 'Alterna';
29
30
  },
30
31
  formatColumns: function () {
31
32
  return 'Colonne';
@@ -32,6 +32,9 @@
32
32
  },
33
33
  formatColumns: function () {
34
34
  return '列';
35
+ },
36
+ formatAllRows: function () {
37
+ return 'すべて';
35
38
  }
36
39
  };
37
40
 
@@ -32,6 +32,9 @@
32
32
  },
33
33
  formatColumns: function () {
34
34
  return 'Lajur';
35
+ },
36
+ formatAllRows: function () {
37
+ return 'Semua';
35
38
  }
36
39
  };
37
40
 
@@ -11,12 +11,12 @@
11
11
  border-radius: 1px;
12
12
  }
13
13
 
14
- .bootstrap-table .table,
15
- .bootstrap-table .table > tbody > tr > th,
16
- .bootstrap-table .table > tfoot > tr > th,
17
- .bootstrap-table .table > thead > tr > td,
18
- .bootstrap-table .table > tbody > tr > td,
19
- .bootstrap-table .table > tfoot > tr > td {
14
+ .bootstrap-table .table:not(.table-condensed),
15
+ .bootstrap-table .table:not(.table-condensed) > tbody > tr > th,
16
+ .bootstrap-table .table:not(.table-condensed) > tfoot > tr > th,
17
+ .bootstrap-table .table:not(.table-condensed) > thead > tr > td,
18
+ .bootstrap-table .table:not(.table-condensed) > tbody > tr > td,
19
+ .bootstrap-table .table:not(.table-condensed) > tfoot > tr > td {
20
20
  padding: 8px !important;
21
21
  }
22
22
 
@@ -294,4 +294,4 @@ div.fixed-table-scroll-outer {
294
294
  width: 200px;
295
295
  height: 150px;
296
296
  overflow: hidden;
297
- }
297
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-table-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Chiu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler