|
@@ -180,11 +180,12 @@
|
|
|
var escapeHTML = function (text) {
|
|
var escapeHTML = function (text) {
|
|
|
if (typeof text === 'string') {
|
|
if (typeof text === 'string') {
|
|
|
return text
|
|
return text
|
|
|
- .replace(/&/g, "&")
|
|
|
|
|
- .replace(/</g, "<")
|
|
|
|
|
- .replace(/>/g, ">")
|
|
|
|
|
- .replace(/"/g, """)
|
|
|
|
|
- .replace(/'/g, "'");
|
|
|
|
|
|
|
+ .replace(/&/g, '&')
|
|
|
|
|
+ .replace(/</g, '<')
|
|
|
|
|
+ .replace(/>/g, '>')
|
|
|
|
|
+ .replace(/"/g, '"')
|
|
|
|
|
+ .replace(/'/g, ''')
|
|
|
|
|
+ .replace(/`/g, '`');
|
|
|
}
|
|
}
|
|
|
return text;
|
|
return text;
|
|
|
};
|
|
};
|
|
@@ -211,17 +212,17 @@
|
|
|
return dataAttr;
|
|
return dataAttr;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- var getItemField = function (item, field) {
|
|
|
|
|
|
|
+ var getItemField = function (item, field, escape) {
|
|
|
var value = item;
|
|
var value = item;
|
|
|
|
|
|
|
|
if (typeof field !== 'string' || item.hasOwnProperty(field)) {
|
|
if (typeof field !== 'string' || item.hasOwnProperty(field)) {
|
|
|
- return item[field];
|
|
|
|
|
|
|
+ return escape ? escapeHTML(item[field]) : item[field];
|
|
|
}
|
|
}
|
|
|
var props = field.split('.');
|
|
var props = field.split('.');
|
|
|
for (var p in props) {
|
|
for (var p in props) {
|
|
|
value = value[props[p]];
|
|
value = value[props[p]];
|
|
|
}
|
|
}
|
|
|
- return value;
|
|
|
|
|
|
|
+ return escape ? escapeHTML(value) : value;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// BOOTSTRAP TABLE CLASS DEFINITION
|
|
// BOOTSTRAP TABLE CLASS DEFINITION
|
|
@@ -286,6 +287,7 @@
|
|
|
showToggle: false,
|
|
showToggle: false,
|
|
|
buttonsAlign: 'right',
|
|
buttonsAlign: 'right',
|
|
|
smartDisplay: true,
|
|
smartDisplay: true,
|
|
|
|
|
+ escape: true,
|
|
|
minimumCountColumns: 1,
|
|
minimumCountColumns: 1,
|
|
|
idField: undefined,
|
|
idField: undefined,
|
|
|
uniqueId: undefined,
|
|
uniqueId: undefined,
|
|
@@ -842,8 +844,8 @@
|
|
|
if (that.header.sortNames[index]) {
|
|
if (that.header.sortNames[index]) {
|
|
|
name = that.header.sortNames[index];
|
|
name = that.header.sortNames[index];
|
|
|
}
|
|
}
|
|
|
- var aa = getItemField(a, name),
|
|
|
|
|
- bb = getItemField(b, name),
|
|
|
|
|
|
|
+ var aa = getItemField(a, name, that.options.escape),
|
|
|
|
|
+ bb = getItemField(b, name, that.options.escape),
|
|
|
value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);
|
|
value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);
|
|
|
|
|
|
|
|
if (value !== undefined) {
|
|
if (value !== undefined) {
|
|
@@ -1502,7 +1504,7 @@
|
|
|
|
|
|
|
|
$.each(this.header.fields, function (j, field) {
|
|
$.each(this.header.fields, function (j, field) {
|
|
|
var text = '',
|
|
var text = '',
|
|
|
- value = getItemField(item, field),
|
|
|
|
|
|
|
+ value = getItemField(item, field, that.options.escape),
|
|
|
type = '',
|
|
type = '',
|
|
|
cellStyle = {},
|
|
cellStyle = {},
|
|
|
id_ = '',
|
|
id_ = '',
|
|
@@ -1631,7 +1633,7 @@
|
|
|
index = $td[0].cellIndex,
|
|
index = $td[0].cellIndex,
|
|
|
field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],
|
|
field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],
|
|
|
column = that.columns[getFieldIndex(that.columns, field)],
|
|
column = that.columns[getFieldIndex(that.columns, field)],
|
|
|
- value = getItemField(item, field);
|
|
|
|
|
|
|
+ value = getItemField(item, field, that.options.escape);
|
|
|
|
|
|
|
|
if ($td.find('.detail-icon').length) {
|
|
if ($td.find('.detail-icon').length) {
|
|
|
return;
|
|
return;
|
|
@@ -2308,14 +2310,14 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.showRow = function (params) {
|
|
BootstrapTable.prototype.showRow = function (params) {
|
|
|
- if (!params.hasOwnProperty('index') && !params.hasOwnProperty('uniqueId')) {
|
|
|
|
|
|
|
+ if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.toggleRow(params.index, params.uniqueId, true);
|
|
this.toggleRow(params.index, params.uniqueId, true);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.hideRow = function (params) {
|
|
BootstrapTable.prototype.hideRow = function (params) {
|
|
|
- if (!params.hasOwnProperty('index') && !params.hasOwnProperty('uniqueId')) {
|
|
|
|
|
|
|
+ if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.toggleRow(params.index, params.uniqueId, false);
|
|
this.toggleRow(params.index, params.uniqueId, false);
|