浏览代码

fix #2272: format the code

zhixin 9 年之前
父节点
当前提交
ce20422ac8
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/bootstrap-table.js

+ 5 - 3
src/bootstrap-table.js

@@ -1001,12 +1001,14 @@
                 return order;
             });
 
-            //$('table tr td:nth-child('+($this.index()+1)+')').css("background-color", "red")
             if (this.options.sortClass !== undefined) {
                 clearTimeout(timeoutId);
                 timeoutId = setTimeout(function () {
-                  that.$el.removeClass(that.options.sortClass);
-                  that.$el.find('tr td:nth-child('+(that.$header.find("[data-field='" + that.options.sortName + "']").index()+1)+')').addClass(that.options.sortClass);
+                    that.$el.removeClass(that.options.sortClass);
+                    var index = that.$header.find(sprintf('[data-field="%s"]',
+                        that.options.sortName).index() + 1);
+                    that.$el.find(sprintf('tr td:nth-child(%s)', index))
+                        .addClass(that.options.sortClass);
                 }, 250);
             }
         }