UNPKG

1.2 kBJavaScriptView Raw
1(function (global, factory) {
2 if (typeof define === "function" && define.amd) {
3 define([], factory);
4 } else if (typeof exports !== "undefined") {
5 factory();
6 } else {
7 var mod = {
8 exports: {}
9 };
10 factory();
11 global.bootstrapTableI18nEnhance = mod.exports;
12 }
13})(this, function () {
14 'use strict';
15
16 /**
17 * @author: Jewway
18 * @version: v1.0.0
19 */
20
21 !function ($) {
22 'use strict';
23
24 var BootstrapTable = $.fn.bootstrapTable.Constructor;
25
26 BootstrapTable.prototype.changeTitle = function (locale) {
27 $.each(this.options.columns, function (idx, columnList) {
28 $.each(columnList, function (idx, column) {
29 if (column.field) {
30 column.title = locale[column.field];
31 }
32 });
33 });
34 this.initHeader();
35 this.initBody();
36 this.initToolbar();
37 };
38
39 BootstrapTable.prototype.changeLocale = function (localeId) {
40 this.options.locale = localeId;
41 this.initLocale();
42 this.initPagination();
43 this.initBody();
44 this.initToolbar();
45 };
46
47 $.fn.bootstrapTable.methods.push('changeTitle');
48 $.fn.bootstrapTable.methods.push('changeLocale');
49 }(jQuery);
50});
\No newline at end of file