浏览代码

addressing code review and lint errors in PR #5494

Aurelien David 5 年之前
父节点
当前提交
b0b3d857d0
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      src/bootstrap-table.js

+ 7 - 6
src/bootstrap-table.js

@@ -1665,18 +1665,19 @@ class BootstrapTable {
       if (tr && typeof tr === 'string') {
 
         const uniqueId = this.options.uniqueId
+
         if (uniqueId && item.hasOwnProperty(uniqueId)) {
           const itemUniqueId = item[uniqueId]
 
           const oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId))
+          const oldTrNext = oldTr.next()
 
-          if (oldTr.next().is('tr.detail-view')) {
+          if (oldTrNext.is('tr.detail-view')) {
 
             toExpand.push(i)
 
-            if (updatedUid && itemUniqueId === updatedUid) {
-            } else {
-              tr += oldTr.next()[0].outerHTML
+            if (!updatedUid || itemUniqueId !== updatedUid) {
+              tr += oldTrNext[0].outerHTML
             }
           }
         }
@@ -1713,7 +1714,7 @@ class BootstrapTable {
       })
     }
 
-    toExpand.forEach((index) => { this.expandRow(index) })
+    toExpand.forEach(index => { this.expandRow(index) })
 
     if (!fixedScroll) {
       this.scrollTo(0)
@@ -2533,7 +2534,7 @@ class BootstrapTable {
 
   updateByUniqueId (params) {
     const allParams = Array.isArray(params) ? params : [params]
-    var updatedUid = null
+    let updatedUid = null
 
     for (const params of allParams) {
       if (!params.hasOwnProperty('id') || !params.hasOwnProperty('row')) {