bootstrap-table-i18n-enhance.js 804 B

1234567891011121314151617181920212223242526272829303132333435
  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. this.initBody();
  25. this.initToolbar();
  26. };
  27. $.fn.bootstrapTable.methods.push('changeTitle');
  28. $.fn.bootstrapTable.methods.push('changeLocale');
  29. }(jQuery);