Browse Source

Impriving the removeByUniqueId

Dennis Hernández 10 years ago
parent
commit
1afc80c4b7
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/bootstrap-table.js

+ 11 - 0
src/bootstrap-table.js

@@ -1846,6 +1846,17 @@
             if (!row.hasOwnProperty(uniqueId)) {
                 continue;
             }
+
+            if (typeof row[uniqueId] === 'string') {
+                id = id.toString();
+            } else if (typeof row[uniqueId] === 'number') {
+                if ((Number(row[uniqueId]) === row[uniqueId]) && (row[uniqueId] % 1 === 0)) {
+                    id = parseInt(id);
+                } else if ((row[uniqueId] === Number(row[uniqueId])) && (row[uniqueId] !== 0)) {
+                    id = parseFloat(id);
+                }
+            }
+
             if (row[uniqueId] === id) {
                 this.options.data.splice(i, 1);
             }