Browse Source

Merge branch 'jackjamieson-column-escape' into develop

zhixin 8 years ago
parent
commit
4deee38e35
2 changed files with 15 additions and 1 deletions
  1. 9 0
      docs/_i18n/en/documentation/column-options.md
  2. 6 1
      src/bootstrap-table.js

+ 9 - 0
docs/_i18n/en/documentation/column-options.md

@@ -254,5 +254,14 @@ function cellStyle(value, row, index, field) {
         True to search use formated data.
         </td>
     </tr>
+    <tr>
+        <td>escape</td>
+        <td>data-escape</td>
+        <td>Boolean</td>
+        <td>false</td>
+        <td>
+        Escapes a string for insertion into HTML, replacing &, <, >, ", `, and ' characters.
+        </td>
+    </tr>
 </tbody>
 </table>

+ 6 - 1
src/bootstrap-table.js

@@ -526,7 +526,8 @@
         cellStyle: undefined,
         searchable: true,
         searchFormatter: true,
-        cardVisible: true
+        cardVisible: true,
+        escape : false
     };
 
     BootstrapTable.EVENTS = {
@@ -1691,6 +1692,10 @@
                 return;
             }
 
+            if (column.escape) {
+                value_ = escapeHTML(value_);
+            }
+
             style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; '));
 
             // handle td's id and class