87,907
社区成员
发帖
与我相关
我的任务
分享
Each(this.tBody.rows, function(o){ this.Rows.push(o); }.bind(this));
this.Rows.sort(!this._order.Compare ? this.Compare.bind(this) : this._order.Compare);
var oFragment = document.createDocumentFragment();
Each(this.Rows, function(o){ oFragment.appendChild(o); });
this.tBody.appendChild(oFragment);
Compare: function(o1, o2) {
var value1 = this.GetValue(o1), value2 = this.GetValue(o2);
return value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
},
var td = tr.getElementsByTagName("td")[this._order.Index]
, data = td[this._order.Attri] ? td[this._order.Attri] : td.getAttribute(this._order.Attri);
switch (this._order.DataType.toLowerCase()) {
case "int":
return parseInt(data) || 0;
case "float":
return parseFloat(data) || 0;
case "date":
return Date.parse(data) || 0;
case "string":
default:
return data.toString() || "";
}
a{outline:none;/*ff*/hide-focus:expression(this.hideFocus=true);/*ie*/}
var to = new TableOrder("idTable");
var order2 = to.Add(0, {
onSort: function(){ Each(SetOrder._arr, function(o){ o.className = ""; }); },
Compare: function(o1, o2) {
var value1 = /x/i.test(to.GetValue(o1)), value2 = /x/i.test(to.GetValue(o2));
return value1 && !value2 ? 1 : !value1 && value2 ? -1 : 0;
}
});
$("idBtn").onclick = function(){ order2.Sort(); }