rendered paste bodyvar TYPE_STRING = 0;var TYPE_NUMBER = 1;var TYPE_DATE = 2;var TYPE_STRING_NO_CASE = 3;var ALIGN_AUTO = 0;var ALIGN_LEFT = 1;var ALIGN_CENTER = 2;var ALIGN_RIGHT = 3;var dxSTable = function() { this.rows = 0; this.rowdata = new Object(); this.rowIDs = new Array(); this.rowSel = new Array(); this.maxRows = 50; this.viewRows = 0; this.cols = 0; this.colsdata = new Array(); this.stSel = null; this.format = function(r) { return r }; this.sIndex = -1; this.reverse = 0; this.secIndex = 0; this.secRev = 0; this.tBody = null; this.tHead = null; this.tHeadCols = new Array(); this.tBodyCols = new Array(); this.colorEvenRows = false; this.sortAscImage = './images/asc.png'; this.sortDescImage = './images/desc.png'; this.cancelSort = false; this.cancelMove = false; this.colMove = new dxSTable.ColumnMove(this); this.colOrder = new Array(); this.onselect = null; this.ondelete = null; this.onsort = null; this.onmove = null; this.onresize = null; this.ondblclick = null; this.sortTimeout = null; this.hotCell = -1; this.isMoving = false; this.isResizing = false; this.isSorting = false; this.mmDrag = 0; this.muDrag = 0; this.selCount = 0};dxSTable.prototype.create = function(a, b) { var c, td, cl, cg, div; this.dCont = a; this.dHead = ELE_DIV.cloneNode(true); this.dBody = ELE_DIV.cloneNode(true); this.dCont.className = 'stable'; this.dHead.className = 'stable-head'; this.dBody.className = 'stable-body'; this.dCont.appendChild(this.dHead); this.dCont.appendChild(this.dBody); this.tHead = ELE_TABLE.cloneNode(true); this.tHead.style.width = '100px'; this.tHead.cellSpacing = 0; this.tHead.cellPadding = 0; this.dHead.appendChild(this.tHead); this.tHead.tb = ELE_TBODY.cloneNode(true); this.tHead.appendChild(this.tHead.tb); c = ELE_TR.cloneNode(true); this.tHead.tb.appendChild(c); var d = this, span; addEvent(window, "unload", function() { d.clearRows() }); var j = 0; for (var i = 0, l = b.length; i < l; i++) { if (typeof this.colOrder[i] == 'undefined') this.colOrder[i] = i; if (typeof b[this.colOrder[i]].enabled == 'undefined') b[this.colOrder[i]].enabled = true; this.cols++; this.colsdata[i] = b[this.colOrder[i]]; if (!b[this.colOrder[i]].enabled) continue; td = ELE_TD.cloneNode(true); c.appendChild(td); td.onmousemove = function(e) { if (d.isResizing) return; e = FixEvent(e); var x = mouse.X - getOffsetLeft(this) + d.dBody.scrollLeft; this.lastMouseX = e.clientX; var w = this.offsetWidth; var i = parseInt(this.getAttribute('index')); if (x <= 8) { if (i != 0) { d.hotCell = i - 1; this.style.cursor = 'e-resize' } else { d.hotCell = -1; this.style.cursor = 'default' } } else if (x >= w - 1) { d.hotCell = i; this.style.cursor = 'e-resize' } else { d.hotCell = -1; this.style.cursor = 'default' } }; span = ELE_DIV.cloneNode(true); span.innerHTML = b[this.colOrder[i]].text; td.appendChild(span); td.style.width = (b[this.colOrder[i]].width) ? b[this.colOrder[i]].width: 'auto'; td.setAttribute('index', i); this.colMove.init(td, preventSort, null, moveColumn); addEvent(td, "mouseup", function(e) { d.Sort(e, this) }); this.tHeadCols[i] = td; j++ } this.tBody = ELE_TABLE.cloneNode(true); this.tBody.style.width = '0'; this.tBody.cellSpacing = 0; this.tBody.cellPadding = 0; this.tpad = ELE_DIV.cloneNode(true); this.tpad.className = 'stable-virtpad'; this.dBody.appendChild(this.tpad); this.dBody.appendChild(this.tBody); this.bpad = ELE_DIV.cloneNode(true); this.bpad.className = 'stable-virtpad'; this.dBody.appendChild(this.bpad); this.tBody.tb = ELE_TBODY.cloneNode(true); this.tBody.appendChild(this.tBody.tb); cg = ELE_COLGROUP.cloneNode(true); this.tBody.appendChild(cg); for (var i = 0, l = b.length, j = 0; i < l; i++) { if (!b[this.colOrder[i]].enabled) continue; cl = ELE_COL.cloneNode(true); cl.style.width = (this.colsdata[i].width) ? this.colsdata[i].width: 'auto'; cg.appendChild(cl); this.tBodyCols[j] = cl; j++ } this.scp = ELE_SPAN.cloneNode(true); this.scp.className = 'stable-scrollpos'; this.dCont.appendChild(this.scp); this.dCont.style.position = 'relative'; this.init()};var preventSort = function() { this.cancelSort = true};var resizeColumn = function() { var a = this.tBody.getElementsByTagName('colgroup')[0].getElementsByTagName('col'); var w = 0, c; for (var i = 0, l = a.length; i < l; i++) { c = this.tHeadCols[i]; w = (browser.isIE) ? iv(c.style.width) : c.offsetWidth; a[i].style.width = w + 'px' } this.tBody.tb.style.width = this.tHead.offsetWidth + 'px'; this.tBody.style.width = this.tHead.offsetWidth + 'px'; if (typeof this.onresize == 'function') this.onresize()};var moveColumn = function(b, c) { var i, l, oParent, oCol, oBefore, aRows, a; if (b == c) { return } oCol = this.tHeadCols[b]; oParent = oCol.parentNode; if (c == this.cols) { oParent.removeChild(oCol); oParent.appendChild(oCol) } else { oBefore = this.tHeadCols[c]; oParent.removeChild(oCol); oParent.insertBefore(oCol, oBefore) } oCol = this.tBody.getElementsByTagName('colgroup')[0].getElementsByTagName('col')[b]; oParent = oCol.parentNode; if (c == this.cols) { oParent.removeChild(oCol); oParent.appendChild(oCol) } else { oBefore = this.tBody.getElementsByTagName('colgroup')[0].getElementsByTagName('col')[c]; oParent.removeChild(oCol); oParent.insertBefore(oCol, oBefore) } aRows = this.tBody.tb.rows; l = aRows.length; i = 0; while (i < l) { oCol = aRows[i].cells[b]; oParent = aRows[i]; if (c == this.cols) { oParent.removeChild(oCol); oParent.appendChild(oCol) } else { oBefore = aRows[i].cells[c]; oParent.removeChild(oCol); oParent.insertBefore(oCol, oBefore) } i++ } var d = new Array(); var e = new Array(); var f = new Array(); var g = new Array(); oCol = this.tHeadCols[b]; var h = this.tBodyCols[b]; for (i = 0; i < this.cols; i++) { if (i == b) continue; if (i == c) { d.push(oCol); e.push(h); f.push(this.colsdata[b]); g.push(this.colOrder[b]) } d.push(this.tHeadCols[i]); e.push(this.tBodyCols[i]); f.push(this.colsdata[i]); g.push(this.colOrder[i]) } if (c == this.cols) { d.push(oCol); e.push(h); f.push(this.colsdata[b]); g.push(this.colOrder[b]) } this.tHeadCols = d.slice(0); this.tBodyCols = e.slice(0); this.colsdata = f.slice(0); this.colOrder = g.slice(0); for (i = 0; i < this.cols; i++) { this.tHeadCols[i].setAttribute('index', i) } if ((c == this.sIndex) && (b > c)) { this.sIndex = c + 1 } else if ((b < c) && (this.sIndex < c) && (this.sIndex > b)) { this.sIndex-- } else if (b == this.sIndex) { this.sIndex = c; if (c > b) this.sIndex = c - 1 } this.cancelSort = false; if (typeof this.onmove == 'function') this.onmove()};dxSTable.ColumnMove = function(p) { this.parent = p; this.obj = ELE_DIV.cloneNode(true); this.obj.className = 'stable-move-header'; this.sepobj = ELE_DIV.cloneNode(true); this.sepobj.className = 'stable-separator-header'};dxSTable.ColumnMove.prototype = { "parent": null, "obj": null, "sepobj": null, "added": false, "rx": -1, "index": -1, "indexnew": -1, "mid": 0, "uid": 0, "init": function(o, a, b, c) { var d = this; o.onmousedown = function(e) { if (d.parent.hotCell > -1) { return } return d.start(e, this) }; this.onDrag = b || new Function(); this.onDragEnd = c || new Function() }, "start": function(e, p) { if (this.parent.cancelMove) return; this.parent.isMoving = true; var o = this.obj; this.index = parseInt(p.getAttribute('index')); while (o.firstChild) o.removeChild(o.firstChild); o.appendChild(document.createTextNode(p.lastChild.innerHTML)); o.style.width = (p.offsetWidth - 16) + 'px'; o.style.left = p.offsetLeft + 'px'; var a = (this.parent.colsdata[this.index].type == TYPE_NUMBER) ? 'right': 'left'; o.style.textAlign = a; this.sepobj.style.left = p.offsetLeft + 'px'; e = FixEvent(e); o.lastMouseX = e.clientX; o.style.visibility = 'visible'; var b = this; this.mid = addEvent(document, "mousemove", function(e) { b.drag(e) }); this.uid = addEvent(document, "mouseup", function(e) { b.end(e) }); this.rx = getLeftPos(this.parent.dHead); return false }, "drag": function(e) { e = FixEvent(e); this.parent.cancelSort = true; var o = this.obj, l = parseInt(o.style.left), ex = e.clientX, i = 0, c = this.parent.cols; if (!this.added) { this.parent.dHead.appendChild(this.obj); this.parent.dHead.appendChild(this.sepobj); this.added = true } l += ex - o.lastMouseX; o.style.left = l + 'px'; var a = 0; var b = ex + this.parent.dBody.scrollLeft - this.rx; for (i = 0; i < c; i++) { a += this.parent.tHeadCols[i].offsetWidth; if (a > b) break } if (i >= c) { this.sepobj.style.left = this.parent.tHeadCols[c - 1].offsetLeft + this.parent.tHeadCols[c - 1].offsetWidth - 1 + 'px'; i = c } else { this.sepobj.style.left = this.parent.tHeadCols[i].offsetLeft + 'px' } this.indexnew = i; this.obj.lastMouseX = ex; this.onDrag.apply(this.parent, [i]); return false }, "end": function() { try { this.parent.dHead.removeChild(this.obj); this.parent.dHead.removeChild(this.sepobj); this.added = false; this.onDragEnd.apply(this.parent, [this.index, this.indexnew]) } catch(e) {} this.index = -1; this.indexnew = -1; this.parent.isMoving = false; this.parent.cancelSort = false; removeEvent(document, "mousemove", this.mid); removeEvent(document, "mouseup", this.uid) }};function getLeftPos(a) { var x = 0; while (a) { x += a.offsetLeft; a = a.offsetParent } return x}function FixEvent(e) { if (typeof e == 'undefined') e = window.event; if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; return e};dxSTable.prototype.Sort = function(e) { if (this.cancelSort) return; this.isSorting = true; var a = null; var b = true; if (e == null) { if (this.sIndex == -1) return; b = false; a = this.tHead.tb.rows[0].cells[this.sIndex] } else { e = FixEvent(e); a = (e.target) ? e.target: e.srcElement } if (a.tagName == 'DIV') a = a.parentNode; var f = parseInt(a.getAttribute('index')); if (Key.isDown(Key.SHIFT)) { if (this.secIndex == f) { this.secRev = 1 - this.secRev } else { this.secRev = 0 } this.secIndex = f; f = this.sIndex; b = false; a = this.tHead.tb.rows[0].cells[this.sIndex] } if (b) { if (this.sIndex == f) { this.reverse = 1 - this.reverse } else { this.reverse = 0 } } if (this.sIndex >= 0) { var g = this.tHead.tb.rows[0].cells[this.sIndex]; g.style.backgroundImage = 'url(./images/blank.gif)' } var h = (this.reverse) ? this.sortAscImage: this.sortDescImage; a.style.backgroundImage = 'url(' + h + ')'; var j = this.colsdata[f].type; this.sIndex = f; var d = this.getCache(f); var u = d.slice(0); var k = this; switch (j) { case TYPE_STRING: d.sort(function(x, y) { return k.sortAlphaNumeric(x, y) }); break; case TYPE_NUMBER: d.sort(function(x, y) { return k.sortNumeric(x, y) }); break; default: d.sort(); break } if (this.reverse) d.reverse(); this.rowIDs = []; var c = 0, i = 0; while (i < this.rows) { this.rowdata[d[i].key] = d[i].e; this.rowIDs.push(d[i].key); i++ } this.clearCache(d); this.clearCache(u); this.isSorting = false; if (!this.isScrolling) this.refreshRows(); if (typeof this.onsort == 'function') this.onsort()};dxSTable.prototype.sortNumeric = function(x, y) { var r = Sort.Numeric(x.v, y.v); if (r == 0) { return this.sortSecondary(x, y) } else { return r }};dxSTable.prototype.sortAlphaNumeric = function(x, y) { var r = Sort.AlphaNumeric(x.v, y.v); if (r == 0) { return this.sortSecondary(x, y) } else { return r }};dxSTable.prototype.sortSecondary = function(x, y) { var m = this.getValue(x.e, this.secIndex); var n = this.getValue(y.e, this.secIndex); if (this.secRev) { var a = m; m = n; n = a } var b = this.colsdata[this.colOrder[this.secIndex]].type; switch (b) { case 0: return Sort.AlphaNumeric(m, n); break; case 1: return Sort.Numeric(m, n); break; default: return Sort.Default(m, n); break }};var Sort = new Object();Sort = { "Default": function(x, y) { var a = x + ""; var b = y + ""; if (a < b) { return - 1 } else if (a > b) { return 1 } else { return 0 } }, "Numeric": function(x, y) { var a = parseFloat(x + ""), b = parseFloat(y + ""), r = null; return (a - b) }, "AlphaNumeric": function(x, y) { var a = (x + "").toLowerCase(); var b = (y + "").toLowerCase(); if (a < b) { return - 1 } else if (a > b) { return 1 } else { return 0 } }};dxSTable.prototype.init = function() { if (navigator.product == 'Gecko') { for (var n = 0, l = document.styleSheets.length; n < l; n++) { if (document.styleSheets[n].cssRules > 1) { continue } var a = document.styleSheets[n].cssRules; for (var i = 0; i < a.length; i++) { if ((a[i].type == CSSRule.STYLE_RULE) && (a[i].selectorText == '.stable-head')) { a[i].style.overflow = '-moz-scrollbars-none' } } } } this.assignEvents(); this.setAlignment()};dxSTable.prototype.assignEvents = function() { var a = this; this.scrollTimeout = null; this.scrollTop = 0; this.scrollDiff = 0; this.scOdd = null; this.isScrolling = false; this.dBody.onscroll = function() { a.dHead.scrollLeft = a.dBody.scrollLeft; if ((a.scrollTop != a.dBody.scrollTop) && (a.viewRows > a.maxRows)) { this.isScrolling = true; a.scOdd = null; a.scrollDiff = a.scrollTop - a.dBody.scrollTop; a.scrollTop = a.dBody.scrollTop; if (Math.abs(a.scrollDiff) == 19) { handleScroll.apply(a); return } a.tBody.style.visibility = 'hidden'; if (a.scrollTimeout != null) window.clearTimeout(a.scrollTimeout); a.scrollTimeout = window.setTimeout(function() { a.isScrolling = false; handleScroll.apply(a) }, 500); a.scrollPos() } }; this.tHead.onmousedown = function(e) { if ((a.hotCell > -1) && !(a.isMoving)) { a.cancelSort = true; a.cancelMove = true; a.mmDrag = addEvent(document, "mousemove", function(e) { a.colDrag(e) }); a.muDrag = addEvent(document, "mouseup", function(e) { a.colDragEnd(e) }) } }; this.tHead.onmouseout = function(e) { this.isOutside = true }; this.tHead.onmouseover = function(e) { this.isOutside = false }; this.tHead.onmouseup = function(e) { if ((a.hotCell > -1) && !(a.isMoving)) { a.cancelSort = false; a.cancelMove = false } }; Key.addListener(this.dCont, { onKeyDown: function(e) { a.keyEvents(e) } }); if (browser.isGecko) addEvent(this.tBody, 'click', function() { a.dBody.focus() })};dxSTable.prototype.colDrag = function(e) { this.isResizing = true; e = FixEvent(e); if (this.hotCell == -1) return false; var o = this.tHeadCols[this.hotCell]; var i = parseInt(o.getAttribute('index')); var a = this.tBody; var b = e.clientX; var w = parseInt(o.style.width); var c = w + b - o.lastMouseX; if (c < 10) return; o.style.width = c + "px"; if (!browser.isOpera && !browser.isAppleWebKit) a.style.width = 'auto'; o.lastMouseX = b; document.body.style.cursor = 'e-resize'; try { document.selection.empty() } catch(b) {} return false};dxSTable.prototype.colDragEnd = function(e) { removeEvent(document, "mousemove", this.mmDrag); removeEvent(document, "mouseup", this.muDrag); this.mmDrag = 0; this.muDrag = 0; this.isResizing = false; resizeColumn.apply(this); if (this.tHead.isOutside) { this.cancelSort = false; this.cancelMove = false } document.body.style.cursor = 'default'};dxSTable.prototype.scrollPos = function() { this.scp.style.display = 'block'; var a = this.dBody.scrollTop / (this.dBody.scrollHeight - this.dBody.clientHeight); if (isNaN(a) || (a < 0)) a = 0; var b = Math.floor(this.dBody.clientHeight / 19); if (b > this.maxRows) b = this.maxRows; var c = Math.floor(Math.floor(this.dBody.scrollTop - ((this.viewRows - this.maxRows) * 19) * a) / 19); var d = Math.ceil(this.viewRows * a) + c; var e = d + b; if (e > this.viewRows) e = this.viewRows; var f = Math.floor(((d + e) / 2)); if (f > this.viewRows) f = this.viewRows - 1; var g = -1; var h = ''; for (var i = 0; i < this.rows; i++) { var j = this.rowIDs[i]; var r = this.rowdata[j]; if (typeof r == 'undefined') continue; if (!r.enabled) continue; g++; if (g == f) h = r.data[0] } this.scp.innerHTML = escapeHTML('Current Row: ' + h)};function handleScroll() { window.clearTimeout(this.scrollTimeout); this.scrollTimeout = null; this.refreshRows(); this.tBody.style.visibility = 'visible'; this.scp.style.display = 'none'};dxSTable.prototype.refreshRows = function() { if (this.isScrolling) return; this.cancelSort = true; var a = this.dBody.scrollTop / (this.dBody.scrollHeight - this.dBody.clientHeight); if (isNaN(a) || (a < 0)) a = 0; var b = Math.floor(this.dBody.clientHeight / 19) + 4; var h = (this.viewRows - this.maxRows) * 19; if (h < 0) { h = 0; a = 0 } var d = Math.floor(h * a); var e = h - d; this.tpad.style.height = d + 'px'; this.bpad.style.height = e + 'px'; var f = Math.ceil(this.viewRows * a); if (f + b > this.viewRows) f = this.viewRows - this.maxRows; if (f < 0) f = 0; var g = f + this.maxRows; var j = this.tBody.tb, vr = -1, i = 0, c = 0, obj = null; for (i = 0; i < this.rows; i++) { var k = this.rowIDs[i]; var r = this.rowdata[k]; if (typeof r == 'undefined') continue; obj = $(k); if (!r.enabled) { if (obj != null) j.removeChild(obj); continue } vr++; if ((vr >= f) && (vr <= g)) { if (typeof j.rows[c] == 'undefined') { if (obj != null) { j.removeChild(obj) } else { obj = this.createRow(r.data, k, r.icon, r.attr) } j.appendChild(obj) } else { if (j.rows[c].id != k) { if (obj != null) { j.removeChild(obj) } else { obj = this.createRow(r.data, k, r.icon, r.attr) } j.insertBefore(obj, j.rows[c]) } } c++ } else { if (obj != null) j.removeChild(obj) } } this.refreshSelection(); this.calcSize(); this.cancelSort = false};dxSTable.prototype.keyEvents = function(e) { e = FixEvent(e); var c = e.keyCode; if (c == Key.DELETE) { if (typeof this.ondelete == 'function') this.ondelete() } else if ((c == 65) && Key.isDown(Key.CTRL)) { this.fillSelection(); if (typeof this.onselect == 'function') this.onselect(e); CancelKeyEvent(e) } else if ((c == 90) && Key.isDown(Key.CTRL)) { this.clearSelection(); if (typeof this.onselect == 'function') this.onselect(e); CancelKeyEvent(e) }};dxSTable.prototype.selectRow = function(e, a) { var b = a.id; if (! ((e.button == 2) && (this.rowSel[b] == true))) { if (Key.isDown(Key.SHIFT)) { if (this.stSel == null) { this.stSel = b; this.rowSel[b] = true; this.selCount = 1 } else { this.selCount = 0; var c = false, passedCID = false, k = ''; for (var i = 0, l = this.rowIDs.length; i < l; i++) { k = this.rowIDs[i]; this.rowSel[k] = false; if ((k == this.stSel) || c) { if (!passedCID) { this.rowSel[k] = true; this.selCount++ } else { if ((k == this.stSel) || (k == b)) { this.rowSel[k] = true; this.selCount++ } } } else if ((k == b) || passedCID) { if (!c) { this.rowSel[k] = true; this.selCount++ } else { if ((k == this.stSel) || (k == b)) { this.rowSel[k] = true; this.selCount++ } } } if (!this.rowdata[k].enabled && this.rowSel[k]) { this.rowSel[k] = false; this.selCount-- } if (k == this.stSel) c = true; if (k == b) passedCID = true } } } else if (Key.isDown(Key.CTRL)) { this.stSel = b; this.rowSel[b] = !this.rowSel[b]; if (this.rowSel[b]) { this.selCount++ } else { this.selCount-- } } else { this.stSel = b; this.selCount = 0; for (var k in this.rowSel) { if (k == b) { this.rowSel[k] = true; this.selCount++ } else { this.rowSel[k] = false } } } if (this.selCount == 0) this.stSel = null; this.refreshSelection() } if (typeof this.onselect == 'function') this.onselect(e, b)};dxSTable.prototype.addRow = function(a, b, c, d) { if (a.length != this.cols) return; if (this.sortTimeout != null) { window.clearTimeout(this.sortTimeout); this.sortTimeout = null } this.rowdata[b] = { "data": a, "icon": c, "attr": d, "enabled": true }; this.rowSel[b] = false; this.rowIDs.push(b); if (this.viewRows < this.maxRows) { this.tBody.tb.appendChild(this.createRow(a, b, c, d)) } this.rows++; this.viewRows++; if (this.viewRows > this.maxRows) this.bpad.style.height = ((this.viewRows - this.maxRows) * 19) + 'px'; var e = this; if (this.sIndex != -1) { this.sortTimeout = window.setTimeout(function() { e.Sort() }, 200) }};dxSTable.prototype.createRow = function(a, b, c, d) { var f, td, div, data, i, l, j; if (typeof(d) == 'undefined') d = []; tb = this.tBody.tb; f = ELE_TR.cloneNode(true); if (b != null) f.id = b; var g = this; if (this.colorEvenRows) f.className = (this.rows & 1) ? 'odd': 'even'; addEvent(f, "mousedown", function(e) { g.selectRow(e, this) }); if (typeof this.ondblclick == 'function') { addEvent(f, "dblclick", function(e) { g.ondblclick(this) }) } f.setAttribute('index', this.rows); for (var k in d) { f.setAttribute(k, d[k]) } data = this.format(a.slice(0)); for (i = 0, j = 0; i < this.cols; i++) { var h = this.colOrder[i]; td = ELE_TD.cloneNode(true); td.className = 'stable-' + this.dCont.id + '-col-' + h; td.setAttribute('rawvalue', a[h]); if ((h == 0) && (c != null)) { div = ELE_SPAN.cloneNode(true); div.className = 'stable-icon ' + c; td.appendChild(div) } else { div = ELE_SPAN.cloneNode(true); div.className = 'stable-lpad'; td.appendChild(div) } div = ELE_DIV.cloneNode(true); div.innerHTML = (data[h] == '') ? ' ': escapeHTML(data[h]); td.appendChild(div); f.appendChild(td) } f.title = a[0]; return f};dxSTable.prototype.removeRow = function(a) { if (typeof this.rowdata[a] == 'undefined') return; if (this.rowdata[a].enabled) this.viewRows--; try { this.tBody.tb.removeChild($(a)) } catch(ex) {} delete this.rowSel[a]; delete this.rowdata[a]; for (var i in this.rowIDs[i]) { if (this.rowIDs[i] == a) { delete this.rowIDs[i]; break } } this.rows--; this.refreshSelection()};dxSTable.prototype.clearRows = function() { var a = this.tBody.tb; while (a.firstChild) a.removeChild(a.firstChild); this.rows = 0; this.viewRows = 0; this.rowSel = new Array(0); this.rowdata = new Array(0); this.rowIDs = new Array(0); this.bpad.style.height = '0px'; this.tpad.style.height = '0px'; this.dBody.scrollTop = 0};dxSTable.prototype.calcSize = function() { if (this.dCont.offsetWidth >= 4) { var h = this.dCont.clientHeight - this.dHead.offsetHeight; if (h >= 0) { this.dBody.style.height = h + 'px' } this.dBody.style.width = this.dCont.offsetWidth - 2 + 'px'; this.dBody.style.paddingTop = this.dHead.offsetHeight + 'px'; this.tBody.style.width = this.dBody.clientWidth + 'px'; if (!browser.isOpera && !browser.isAppleWebKit) this.tBody.style.width = 'auto'; var a = ((this.dBody.offsetWidth - this.dBody.clientWidth) == 0); this.dHead.style.width = this.dBody.clientWidth + ((a) ? -2 : 0) + 'px'; if ((this.cols > 0) && (!this.isResizing)) { var j = -1; for (var i = 0, l = this.cols; i < l; i++) { var b = iv(this.tBodyCols[i].style.width); if (!b) b = this.tBodyCols[i].offsetWidth; if (!b) continue; if (browser.isIE && (this.tBodyCols[i].offsetWidth != 0)) b = this.tBodyCols[i].offsetWidth; this.tHeadCols[i].style.width = (b - 4) + 'px' } } }};dxSTable.prototype.setAlignment = function() { var i, aRows, aAlign, j; aAlign = new Array(); for (i = 0; i < this.cols; i++) { switch (this.colsdata[i].align) { case ALIGN_LEFT: align = 'left'; break; case ALIGN_CENTER: align = 'center'; break; case ALIGN_RIGHT: align = 'right'; break; case ALIGN_AUTO: default: switch (this.colsdata[i].type) { case TYPE_NUMBER: align = 'right'; break; default: align = 'left' } }; aAlign.push(align) } for (i = 0, j = 0; i < this.cols; i++) { this.tHeadCols[i].style.textAlign = aAlign[i] } var a = this.tBody.getElementsByTagName('colgroup')[0].getElementsByTagName('col'); var b = a.length; if (document.all || browser.isAppleWebKit) { for (var i = 0; i < b; i++) { a[i].align = aAlign[i] } } else { var c = null, rules = null; for (var n = 0, l = document.styleSheets.length; n < l; n++) { if (document.styleSheets[n].cssRules.length <= 1) { continue } c = document.styleSheets[n]; rules = c.cssRules } if (rules == null) { return } if (typeof this.colRules == 'undefined') { this.colRules = new Array() } for (var j = 0; j < b; j++) { var k = this.colOrder[j]; if (!this.colRules[k]) { for (var i = 0, l = rules.length; i < l; i++) { if ((rules[i].type == CSSRule.STYLE_RULE) && (rules[i].selectorText == '.stable-' + this.dCont.id + '-col-' + k)) { this.colRules[k] = rules[i]; break } } } if (typeof this.colRules[k] != 'undefined') { this.colRules[k].style.textAlign = aAlign[j] } else { this.colRules[k] = c.insertRule('.stable-' + this.dCont.id + '-col-' + k + ' div { text-align: ' + aAlign[j] + ' };', 0) } } }};dxSTable.prototype.hideRow = function(a) { if (this.rowdata[a].enabled) this.viewRows--; this.rowdata[a].enabled = false};dxSTable.prototype.unhideRow = function(a) { if (!this.rowdata[a].enabled) this.viewRows++; this.rowdata[a].enabled = true};dxSTable.prototype.refreshSelection = function(a) { var b = this.tBody.tb.rows, l = b.length, j = 0; if (a) j = 1; for (var i = 0; i < l; i++) { if (this.rowSel[b[i].id] == true) { b[i].className = 'selected' } else { if (!this.colorEvenRows) { b[i].className = 'even' } else { b[i].className = (j & 1) ? 'odd': 'even' } } j++ }};dxSTable.prototype.clearSelection = function() { for (var k in this.rowSel) { this.rowSel[k] = false } this.selCount = 0; this.refreshSelection()};dxSTable.prototype.fillSelection = function() { this.selCount = 0; for (var k in this.rowSel) { if (this.rowdata[k].enabled) { this.rowSel[k] = true; this.selCount++ } else { this.rowSel[k] = false } } this.refreshSelection()};dxSTable.prototype.getCache = function(b) { if (!this.tBody) return []; var a = new Array(0); for (var k in this.rowdata) { a.push({ "key": k, "v": this.getValue(this.rowdata[k], b), "e": this.rowdata[k] }) } this.rowdata = []; return a};dxSTable.prototype.clearCache = function(a) { var l = a.length; for (var i = 0; i < l; i++) { a[i].v = null; a[i].e = null; a[i] = null }};dxSTable.prototype.getColOrder = function(a) { for (var i = 0; i < this.cols; i++) { if (this.colOrder[i] == a) return i } return - 1};dxSTable.prototype.getValue = function(a, b) { return a.data[this.colOrder[b]]};dxSTable.prototype.setValue = function(a, b, d) { this.rowdata[a].data[b] = d; var r = $(a); if (r == null) return; d = this.format(d, b); var c = this.getColOrder(b); var e = r.cells[c]; e.lastChild.innerHTML = escapeHTML(d)};dxSTable.prototype.setIcon = function(a, b) { this.rowdata[a].icon = b; var r = $(a); if (r == null) return; var c = r.cells[this.getColOrder(0)]; c.firstChild.className = 'stable-icon ' + b};dxSTable.prototype.setAttr = function(a, b, c) { this.rowdata[a].attr[b] = c; var r = $(a); if (r == null) return; r.setAttribute(b, c)};dxSTable.prototype.getAttr = function(a, b) { return this.rowdata[a].attr[b]};dxSTable.prototype.resize = function(w, h) { if (w) this.dCont.style.width = w + 'px'; if (h) this.dCont.style.height = h + 'px'; this.calcSize()};function CopyArray(a) { var b = []; for (var i = 0; i < a.length; i++) { b[i] = a[i].slice(0) } return b}