Browse Source

fixed bug with json object

Dustin Utecht 6 years ago
parent
commit
4a31313d67

+ 1 - 1
src/bootstrap-table.js

@@ -1162,7 +1162,7 @@ class BootstrapTable {
       Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id),
       Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id),
       Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)),
       Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)),
       ` data-index="${i}"`,
       ` data-index="${i}"`,
-      Utils.sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),
+      Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)),
       Utils.sprintf(' data-has-detail-view="%s"', (!this.options.cardView && this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) ? 'true' : undefined),
       Utils.sprintf(' data-has-detail-view="%s"', (!this.options.cardView && this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) ? 'true' : undefined),
       Utils.sprintf('%s', data_),
       Utils.sprintf('%s', data_),
       '>'
       '>'

+ 3 - 2
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -651,10 +651,11 @@ $.BootstrapTable = class extends $.BootstrapTable {
     that.data = fp
     that.data = fp
       ? that.options.data.filter((item, i) => {
       ? that.options.data.filter((item, i) => {
         const itemIsExpected = []
         const itemIsExpected = []
-        Object.keys(item).forEach((key, index) => {
+        Object.keys(item).forEach((x, index) => {
+          const key = that.header.fields[index]
           const thisColumn = that.columns[that.fieldsColumnsIndex[key]]
           const thisColumn = that.columns[that.fieldsColumnsIndex[key]]
           const fval = (fp[key] || '').toLowerCase()
           const fval = (fp[key] || '').toLowerCase()
-          let value = item[key]
+          let value = Utils.getItemField(item, key, false)
 
 
           if (fval === '') {
           if (fval === '') {
             itemIsExpected.push(true)
             itemIsExpected.push(true)