浏览代码

Added a new table option "escapeTitle" to toggle the "escape" option for the column titles

Dustin Utecht 3 年之前
父节点
当前提交
164c73257c
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 2 2
      src/bootstrap-table.js
  2. 1 0
      src/constants/index.js

+ 2 - 2
src/bootstrap-table.js

@@ -355,7 +355,7 @@ class BootstrapTable {
         html.push(Utils.sprintf('<div class="th-inner %s">',
           this.options.sortable && column.sortable ? `sortable${columnHalign === 'center' ? ' sortable-center' : ''} both` : ''))
 
-        let text = this.options.escape ? Utils.escapeHTML(column.title) : column.title
+        let text = this.options.escape && this.options.escapeTitle ? Utils.escapeHTML(column.title) : column.title
 
         const title = text
 
@@ -3347,7 +3347,7 @@ class BootstrapTable {
     }
 
     this.columns[this.fieldsColumnsIndex[params.field]].title =
-      this.options.escape ? Utils.escapeHTML(params.title) : params.title
+      this.options.escape && this.options.escapeTitle ? Utils.escapeHTML(params.title) : params.title
 
     if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
       this.$header.find('th[data-field]').each((i, el) => {

+ 1 - 0
src/constants/index.js

@@ -210,6 +210,7 @@ const DEFAULTS = {
   showFullscreen: false,
   smartDisplay: true,
   escape: false,
+  escapeTitle: true,
   filterOptions: {
     filterAlgorithm: 'and'
   },