bootstrap-table-i18n-enhance.js 759 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @author: Jewway
  3. * @version: v1.0.0
  4. */
  5. !function ($) {
  6. 'use strict';
  7. var BootstrapTable = $.fn.bootstrapTable.Constructor;
  8. BootstrapTable.prototype.changeTitle = function (locale) {
  9. $.each(this.options.columns, function (idx, columnList) {
  10. $.each(columnList, function (idx, column) {
  11. if (column.field) {
  12. column.title = locale[column.field];
  13. }
  14. });
  15. });
  16. this.initHeader();
  17. this.initBody();
  18. this.initToolbar();
  19. };
  20. BootstrapTable.prototype.changeLocale = function (localeId) {
  21. this.options.locale = localeId;
  22. this.initLocale();
  23. this.initPagination();
  24. };
  25. $.fn.bootstrapTable.methods.push('changeTitle');
  26. $.fn.bootstrapTable.methods.push('changeLocale');
  27. }(jQuery);