ソースを参照

Allow uniqueId to be a mix of numbers and strings.

If some rows have the uniqueId as a number and some rows have it as a
string, the code would try to convert the id being searched to a number,
which would result in a NaN if it was a string. This would then fail to
match any rows.
The proper fix is to always use the original _id value to convert to the
appropriate type for the comparison.
Melvin Cardozo 1 年間 前
コミット
5e9b8691f4
1 ファイル変更3 行追加3 行削除
  1. 3 3
      src/bootstrap-table.js

+ 3 - 3
src/bootstrap-table.js

@@ -2662,12 +2662,12 @@ class BootstrapTable {
       }
 
       if (typeof rowUniqueId === 'string') {
-        id = id.toString()
+        id = _id.toString()
       } else if (typeof rowUniqueId === 'number') {
         if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
-          id = parseInt(id, 10)
+          id = parseInt(_id, 10)
         } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
-          id = parseFloat(id)
+          id = parseFloat(_id)
         }
       }