1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-16 15:45:45 +01:00
TableFilter/tablefilter/tf-1.js
koalyptus db65cd26b8 publish TableFilter to gh-pages (auto)
branch:       master
SHA:          8335d35c39
range SHA:    c22f9a5c6a8a...8335d35c39cf
build id:     105139229
build number: 154
2016-01-27 11:13:51 +00:00

8 lines
No EOL
46 KiB
JavaScript

/**
* tablefilter v0.1.9 by Max Guglielmi
* build date: 2016-01-27T11:12:06.328Z
* MIT License
*/
webpackJsonp([1],{26:function(e,t,n){function s(e){return n(i(e))}function i(e){return l[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var l={"./array":16,"./array.js":16,"./cookie":9,"./cookie.js":9,"./date":5,"./date.js":5,"./dom":2,"./dom.js":2,"./emitter":7,"./emitter.js":7,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":6,"./helpers.js":6,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/feature":11,"./modules/feature.js":11,"./modules/gridLayout":10,"./modules/gridLayout.js":10,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":8,"./modules/store.js":8,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":4,"./types.js":4};s.keys=function(){return Object.keys(l)},s.resolve=i,e.exports=s,s.id=26},27:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=s(o),r=function(){function e(t,n){i(this,e),this.initialized=!1,this.desc=n.description||"ezEditTable adapter",this.filename=n.filename||"ezEditTable.js",this.vendorPath=n.vendor_path,this.loadStylesheet=Boolean(n.load_stylesheet),this.stylesheet=n.stylesheet||this.vendorPath+"ezEditTable.css",this.stylesheetName=n.stylesheet_name||"ezEditTableCss",this.err='Failed to instantiate EditTable object.\n"ezEditTable" dependency not found.',n.scroll_into_view=n.scroll_into_view===!1?!1:t.gridLayout,this._ezEditTable=null,this.cfg=n,this.tf=t,this.emitter=t.emitter}return l(e,[{key:"init",value:function(){var e=this,t=this.tf;if(window.EditTable)this._setAdvancedGrid();else{var n=this.vendorPath+this.filename;t["import"](this.filename,n,function(){e._setAdvancedGrid()})}this.loadStylesheet&&!t.isImported(this.stylesheet,"link")&&t["import"](this.stylesheetName,this.stylesheet,null,"link"),this.emitter.on(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()})}},{key:"_setAdvancedGrid",value:function(){var e,t=this.tf,n=this.cfg,s=a["default"].tag(t.tbl,"thead");e=s.length>0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var i=n.editable,l=n.selection;l&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var o=0,r=0;if(l){var d=function(e,n,s){var i=e.Selection,l=function(s){if("row"===e.defaultSelection)i.SelectRowByIndex(s);else{e.ClearSelections();var l=n.cellIndex,o=t.tbl.rows[s];"both"===e.defaultSelection&&i.SelectRowByIndex(s),o&&i.SelectCell(o.cells[l])}if(t.validRowsIndex.length!==t.getRowsNb()){var a=t.tbl.rows[s];a&&a.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var a,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==s?e.Event.GetKey(s):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(o=d.indexOf(c.rowIndex),r=c.rowIndex):(a=34===f?u-1>=o+m?d[o+m]:[u-1]:o-m<=d[0]?d[0]:d[o-m],r=a,o=d.indexOf(a),l(a));else{if(c.rowIndex>r)if(c.rowIndex>=d[u-1])a=d[u-1];else{var g=o+m;a=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])a=d[0];else{var y=d[o-m];a=y?y:d[0]}r=c.rowIndex,l(a)}}},u=function(e,n){var s="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var i=t.feature("paging");e.nbRowsPerPage=i.pagingLength;var l=t.validRowsIndex,o=l.length,a=parseInt(i.startPagingRow,10)+parseInt(i.pagingLength,10),r=s.rowIndex;r===l[o-1]&&i.currentPageNb!==i.nbPages?i.setPage("last"):r==l[0]&&1!==i.currentPageNb?i.setPage("first"):r>l[a-1]&&r<l[o-1]?i.setPage("next"):r<l[i.startPagingRow]&&r>l[0]&&i.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,s=n.Selection,i=s.GetActiveRow();i&&i.scrollIntoView(!1);var l=s.GetActiveCell();l&&l.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(i){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"_toggleForInputFilter",value:function(){var e=this.tf;if(e.activeFlt){var t=e.activeFlt.getAttribute("ct"),n=e.getFilterType(t);n===e.fltTypeInp&&this.toggle()}}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()}),this.initialized=!1}}]),e}();t["default"]=r},28:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(27),l=s(i);t["default"]=l["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _dom=__webpack_require__(2),_dom2=_interopRequireDefault(_dom),_string=__webpack_require__(3),_string2=_interopRequireDefault(_string),_types=__webpack_require__(4),_types2=_interopRequireDefault(_types),ColOps=function(){function ColOps(e,t){_classCallCheck(this,ColOps),this.onBeforeOperation=_types2["default"].isFn(t.on_before_operation)?t.on_before_operation:null,this.onAfterOperation=_types2["default"].isFn(t.on_after_operation)?t.on_after_operation:null,this.opts=t,this.tf=e}return _createClass(ColOps,[{key:"init",value:function(){var e=this;this.tf.emitter.on(["after-filtering"],function(){return e.calc()}),this.calc()}},{key:"calc",value:function calc(){var tf=this.tf;if(tf.hasGrid()){this.onBeforeOperation&&this.onBeforeOperation.call(null,tf);var opts=this.opts,labelId=opts.id,colIndex=opts.col,operation=opts.operation,outputType=opts.write_method,totRowIndex=opts.tot_row_index,excludeRow=opts.exclude_row,decimalPrecision=_types2["default"].isUndef(opts.decimal_precision)?2:opts.decimal_precision,ucolIndex=[],ucolMax=0;ucolIndex[ucolMax]=colIndex[0];for(var ii=1;ii<colIndex.length;ii++){for(var saved=0,jj=0;ucolMax>=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;k<colIndex.length;k++)if(colIndex[k]===ucolIndex[ucol])switch(mThisCol++,opsThisCol[mThisCol]=_string2["default"].lower(operation[k]),decThisCol[mThisCol]=decimalPrecision[k],labThisCol[mThisCol]=labelId[k],oTypeThisCol=void 0!==outputType&&"object"===_string2["default"].lower("undefined"==typeof outputType?"undefined":_typeof(outputType))?outputType[k]:null,opsThisCol[mThisCol]){case"mean":meanFlag=1;break;case"sum":sumFlag=1;break;case"min":minFlag=1;break;case"max":maxFlag=1;break;case"median":medFlag=1;break;case"q1":q1Flag=1;break;case"q3":q3Flag=1}for(var j=0;j<colvalues[ucol].length;j++){if((1==q1Flag||1==q3Flag||1==medFlag)&&j<colvalues[ucol].length-1)for(k=j+1;k<colvalues[ucol].length;k++)eval(colvalues[ucol][k])<eval(colvalues[ucol][j])&&(temp=colvalues[ucol][j],colvalues[ucol][j]=colvalues[ucol][k],colvalues[ucol][k]=temp);var cvalue=parseFloat(colvalues[ucol][j]);theList[j]=parseFloat(cvalue),isNaN(cvalue)||(nbvalues++,(1===sumFlag||1===meanFlag)&&(sumValue+=parseFloat(cvalue)),1===minFlag&&(minValue=null===minValue?parseFloat(cvalue):parseFloat(cvalue)<minValue?parseFloat(cvalue):minValue),1===maxFlag&&(maxValue=null===maxValue?parseFloat(cvalue):parseFloat(cvalue)>maxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=s(o),r=n(4),d=s(r),u=n(1),c=s(u),h=function(){function e(t,n){i(this,e);var s=t.config();this.initialized=!1,this.name=n.name,this.desc=n.description||"Columns visibility manager",this.spanEl=null,this.btnEl=null,this.contEl=null,this.tickToHide=n.tick_to_hide===!1?!1:!0,this.manager=n.manager===!1?!1:!0,this.headersTbl=n.headers_table||!1,this.headersIndex=n.headers_index||1,this.contElTgtId=n.container_target_id||null,this.headersText=n.headers_text||null,this.btnTgtId=n.btn_target_id||null,this.btnText=n.btn_text||"Columns&#9660;",this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"colVis",this.btnCloseText=n.btn_close_text||"Close",this.btnCloseHtml=n.btn_close_html||null,this.btnCloseCssClass=n.btn_close_css_class||this.btnCssClass,this.stylesheet=n.stylesheet||"colsVisibility.css",this.prfx="colVis_",this.spanCssClass=n.span_css_class||"colVisSpan",this.prfxCont=this.prfx+"Cont_",this.contCssClass=n.cont_css_class||"colVisCont",this.listCssClass=s.list_css_class||"cols_checklist",this.listItemCssClass=s.checklist_item_css_class||"cols_checklist_item",this.listSlcItemCssClass=s.checklist_selected_item_css_class||"cols_checklist_slc_item",this.text=n.text||(this.tickToHide?"Hide: ":"Show: "),this.atStart=n.at_start||null,this.enableHover=Boolean(n.enable_hover),this.enableTickAll=Boolean(n.enable_tick_all),this.tickAllText=n.tick_all_text||"Select all:",this.hiddenCols=[],this.tblHasColTag=a["default"].tag(t.tbl,"col").length>0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return l(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,s=this.onAfterOpen,i=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",s&&"inline"!==e&&s.call(null,this),i&&"inline"===e&&i.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,s=e.firstChild.getAttribute("id").split("_")[1];s=parseInt(s,10),n?a["default"].addClass(t,this.listSlcItemCssClass):a["default"].removeClass(t,this.listSlcItemCssClass);var i=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(i=!0),this.setHidden(s,i)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=a["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var s=this.btnTgtId?a["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)s.appendChild(n);else{var i=s.firstChild;i.parentNode.insertBefore(n,i)}if(this.btnHtml){n.innerHTML=this.btnHtml;var l=n.firstChild;this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}else{var o=a["default"].create("a",["href","javascript:;"]);o.className=this.btnCssClass,o.title=this.desc,o.innerHTML=this.btnText,n.appendChild(o),this.enableHover?c["default"].add(o,"mouseover",function(t){e.toggle(t)}):c["default"].add(o,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?a["default"].id(this.contElTgtId):a["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var s=a["default"].create("p");s.innerHTML=this.text,n.appendChild(s);var i=a["default"].create("ul",["id","ul"+this.name+"_"+t.id]);i.className=this.listCssClass;var l=this.headersTbl?this.headersTbl:t.tbl,o=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),r=l.rows[o];if(this.enableTickAll){var d=a["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);a["default"].addClass(d,this.listItemCssClass),i.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e<r.cells.length;e++){var n=a["default"].id("col_"+e+"_"+t.id);n&&d.check.checked!==n.checked&&(n.click(),n.checked=d.check.checked)}})}for(var u=0;u<r.cells.length;u++){var h=r.cells[u],f=this.headersText&&this.headersText[u]?this.headersText[u]:this._getHeaderText(h),p=a["default"].createCheckItem("col_"+u+"_"+t.id,f,f);a["default"].addClass(p,this.listItemCssClass),this.tickToHide||a["default"].addClass(p,this.listSlcItemCssClass),i.appendChild(p),this.tickToHide||(p.check.checked=!0),c["default"].add(p.check,"click",function(t){var n=c["default"].target(t),s=n.parentNode;e.checkItem(s)})}var b,m=a["default"].create("p",["align","center"]);if(this.btnCloseHtml?(m.innerHTML=this.btnCloseHtml,b=m.firstChild,c["default"].add(b,"click",function(t){e.toggle(t)})):(b=a["default"].create("a",["href","javascript:;"]),b.className=this.btnCloseCssClass,b.innerHTML=this.btnCloseText,c["default"].add(b,"click",function(t){e.toggle(t)}),m.appendChild(b)),n.appendChild(i),n.appendChild(m),this.btnEl.parentNode.insertBefore(n,this.btnEl),this.contEl=n,this.atStart)for(var g=this.atStart,y=0;y<g.length;y++){var v=a["default"].id("col_"+g[y]+"_"+t.id);v&&v.click()}}},{key:"setHidden",value:function(e,t){var n=this.tf,s=n.tbl;this.onBeforeColHidden&&t&&this.onBeforeColHidden.call(null,this,e),this.onBeforeColDisplayed&&!t&&this.onBeforeColDisplayed.call(null,this,e),this._hideCells(s,e,t),this.headersTbl&&this._hideCells(this.headersTbl,e,t);var i=this.hiddenCols,l=i.indexOf(e);t?-1===l&&this.hiddenCols.push(e):-1!==l&&this.hiddenCols.splice(l,1);var o,a,r;if(this.onAfterColHidden&&t){if(n.gridLayout){o=n.feature("gridLayout"),a=o.headTbl,r=o.gridColElms;var d=parseInt(r[e].style.width,10),u=parseInt(a.style.width,10);a.style.width=u-d+"px",s.style.width=a.style.width}this.onAfterColHidden.call(null,this,e)}if(this.onAfterColDisplayed&&!t){if(n.gridLayout){o=n.feature("gridLayout"),a=o.headTbl,r=o.gridColElms;var c=parseInt(r[e].style.width,10);a.style.width=parseInt(a.style.width,10)+c+"px",n.tbl.style.width=a.style.width}this.onAfterColDisplayed.call(null,this,e)}}},{key:"showCol",value:function(e){if(void 0!==e&&this.isColHidden(e))if(this.manager&&this.contEl){var t=a["default"].id("col_"+e+"_"+this.tf.id);t&&t.click()}else this.setHidden(e,!1)}},{key:"hideCol",value:function(e){if(void 0!==e&&!this.isColHidden(e))if(this.manager&&this.contEl){var t=a["default"].id("col_"+e+"_"+this.tf.id);t&&t.click()}else this.setHidden(e,!0)}},{key:"isColHidden",value:function(e){return-1!==this.hiddenCols.indexOf(e)?!0:!1}},{key:"toggleCol",value:function(e){void 0===e||this.isColHidden(e)?this.showCol(e):this.hideCol(e)}},{key:"getHiddenCols",value:function(){return this.hiddenCols}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(a["default"].id(this.contElTgtId)?a["default"].id(this.contElTgtId).innerHTML="":(this.contEl.innerHTML="",a["default"].remove(this.contEl),this.contEl=null),this.btnEl.innerHTML="",a["default"].remove(this.btnEl),this.btnEl=null,this.initialized=!1)}},{key:"_getHeaderText",value:function(e){if(!e.hasChildNodes)return"";for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(3===n.nodeType)return n.nodeValue;if(1===n.nodeType){if(n.id&&-1!==n.id.indexOf("popUp"))continue;return a["default"].getText(n)}}return""}},{key:"_hideCells",value:function(e,t,n){for(var s=0;s<e.rows.length;s++){var i=e.rows[s],l=i.cells[t];l&&(l.style.display=n?"none":"")}}}]),e}();t["default"]=h},31:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=s(o),r=n(4),d=s(r),u=n(1),c=s(u),h=function(){function e(t,n){i(this,e),this.initialized=!1,this.name=n.name,this.desc=n.description||"Filters row visibility manager",this.stylesheet=n.stylesheet||"filtersVisibility.css",this.icnExpand=n.expand_icon_name||"icn_exp.png",this.icnCollapse=n.collapse_icon_name||"icn_clp.png",this.contEl=null,this.btnEl=null,this.icnExpandHtml='<img src="'+t.themesPath+this.icnExpand+'" alt="Expand filters" >',this.icnCollapseHtml='<img src="'+t.themesPath+this.icnCollapse+'" alt="Collapse filters" >',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return l(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=a["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var s=this.targetId?a["default"].id(this.targetId):t.rDiv;if(this.targetId)s.appendChild(n);else{var i=s.firstChild;i.parentNode.insertBefore(n,i)}var l=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,l=n.firstChild):(l=a["default"].create("a",["href","javascript:void(0);"]),l.className=this.btnCssClass,l.title=this.btnText||this.defaultText,l.innerHTML=this.collapseBtnHtml,n.appendChild(l)),c["default"].add(l,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=l,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],s=n.style.display;this.onBeforeShow&&""!==s&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===s&&this.onBeforeHide.call(null,this),n.style.display=""===s?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===s?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==s&&this.onAfterShow.call(null,this),this.onAfterHide&&""===s&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",a["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",a["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e){return S["default"].removeNbFormat(e,"us")}function o(e){return S["default"].removeNbFormat(e,"eu")}function a(e,t){return C["default"].format(e,t)}function r(e){return a(e,"DMY")}function d(e){return a(e,"MDY")}function u(e){return a(e,"YMD")}function c(e){return a(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var s=t[n];3>s.length;)s="0"+s;t[n]=s}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),s=h(t.value.toLowerCase());return n==s?0:s>n?-1:1}var p=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}();Object.defineProperty(t,"__esModule",{value:!0});var b=n(4),m=s(b),g=n(2),y=s(g),v=n(1),T=s(v),_=n(5),C=s(_),w=n(6),S=s(w),x=function(){function e(t,n){i(this,e),this.initialized=!1,this.name=n.name,this.desc=n.description||"Sortable table",this.sorted=!1,this.sortTypes=m["default"].isArray(n.types)?n.types:[],this.sortColAtStart=m["default"].isArray(n.sort_col_at_start)?n.sort_col_at_start:null,this.asyncSort=Boolean(n.async_sort),this.triggerIds=m["default"].isArray(n.trigger_ids)?n.trigger_ids:[],this.imgPath=n.images_path||t.themesPath,this.imgBlank=n.image_blank||"blank.png",this.imgClassName=n.image_class_name||"sort-arrow",this.imgAscClassName=n.image_asc_class_name||"ascending",this.imgDescClassName=n.image_desc_class_name||"descending",this.customKey=n.custom_key||"data-tf-sortKey",this.onSortLoaded=m["default"].isFn(n.on_sort_loaded)?n.on_sort_loaded:null,this.onBeforeSort=m["default"].isFn(n.on_before_sort)?n.on_before_sort:null,this.onAfterSort=m["default"].isFn(n.on_after_sort)?n.on_after_sort:null,this.tf=t,this.emitter=t.emitter}return p(e,[{key:"init",value:function(){var e=this.tf,t=this;if(m["default"].isUndef(SortableTable))throw new Error("SortableTable class not found.");this.overrideSortableTable(),this.setSortTypes();var n=t.sortColAtStart;n&&this.stt.sort(n[0],n[1]),this.onSortLoaded&&this.onSortLoaded.call(null,e,this),this.stt.onbeforesort=function(){t.onBeforeSort&&t.onBeforeSort.call(null,e,t.stt.sortColumn),e.paging&&e.feature("paging").disable()},this.stt.onsort=function(){if(t.sorted=!0,e.paging){var n=e.feature("paging");e.getValidRows(!0),n.enable(),n.setPage(n.getPage())}t.onAfterSort&&t.onAfterSort.call(null,e,t.stt.sortColumn),t.emitter.emit("column-sorted",e,t.stt.sortColumn)},this.initialized=!0}},{key:"sortByColumnIndex",value:function(e,t){this.stt.sort(e,t)}},{key:"overrideSortableTable",value:function(){var e=this,t=this.tf;SortableTable.prototype.headerOnclick=function(t){if(e.initialized){for(var n=t.target||t.srcElement;"TD"!==n.tagName&&"TH"!==n.tagName;)n=n.parentNode;this.sort(SortableTable.msie?SortableTable.getCellIndex(n):n.cellIndex)}},SortableTable.getCellIndex=function(e){var t=e.parentNode.cells,n=t.length,s=void 0;for(s=0;t[s]!=e&&n>s;s++);return s},SortableTable.prototype.initHeader=function(n){var s=this;if(!s.tHead){if(!t.gridLayout)return;s.tHead=t.feature("gridLayout").headTbl.tHead}s.headersRow=t.headersRow;var i=s.tHead.rows[s.headersRow].cells;s.sortTypes=n||[];for(var l=i.length,o=void 0,a=void 0,r=0;l>r;r++)a=i[r],null!==s.sortTypes[r]&&"None"!==s.sortTypes[r]?(a.style.cursor="pointer",o=y["default"].create("img",["src",e.imgPath+e.imgBlank]),a.appendChild(o),null!==s.sortTypes[r]&&a.setAttribute("_sortType",s.sortTypes[r]),T["default"].add(a,"click",s._headerOnclick)):(a.setAttribute("_sortType",n[r]),a._sortType="None");s.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,s=void 0,i=void 0;if(e.asyncSort&&e.triggerIds.length>0){var l=e.triggerIds;n=[],s=l.length;for(var o=0;o<l.length;o++)n.push(y["default"].id(l[o]))}else{if(!this.tHead)return;n=t.tHead.rows[t.headersRow].cells,s=n.length}for(var a=0;s>a;a++){var r=n[a].getAttribute("_sortType");null!==r&&"None"!==r&&(i=n[a].lastChild||n[a],"img"!==i.nodeName.toLowerCase()&&(i=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[a].appendChild(i)),a===t.sortColumn?i.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):i.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var s=this,i=s._sortTypeInfo[t];if(i&&i.getRowValue)return i.getRowValue(e,n);var l=e.cells[n],o=SortableTable.getInnerText(l);return s.getValueFromString(o,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,s=[],i=0;i<t.nbCells;i++){var a=void 0;n[i]?(a=n[i].toLowerCase(),"none"===a&&(a="None")):a=t.hasColNbFormat&&null!==t.colNbFormat[i]?t.colNbFormat[i].toLowerCase():t.hasColDateType&&null!==t.colDateType[i]?t.colDateType[i].toLowerCase()+"date":"String",s.push(a)}this.addSortType("number",Number),this.addSortType("caseinsensitivestring",SortableTable.toUpperCase),this.addSortType("date",SortableTable.toDate),this.addSortType("string"),this.addSortType("us",l),this.addSortType("eu",o),this.addSortType("dmydate",r),this.addSortType("ymddate",u),this.addSortType("mdydate",d),this.addSortType("ddmmmyyyydate",c),this.addSortType("ipaddress",h,f),this.stt=new SortableTable(t.tbl,s),
this.asyncSort&&this.triggerIds.length>0&&!function(){for(var t=e.triggerIds,n=0;n<t.length;n++)if(null!==t[n]){var i=y["default"].id(t[n]);i&&(i.style.cursor="pointer",T["default"].add(i,"click",function(n){var s=n.target;e.tf.sort&&e.stt.asyncSort(t.indexOf(s.id))}),i.setAttribute("_sortType",s[n]))}}()}},{key:"destroy",value:function(){var e=this.tf;this.sorted=!1,this.initialized=!1,this.stt.destroy();for(var t=e.getFiltersId(),n=0;n<t.length;n++){var s=e.getHeaderElement(n),i=y["default"].tag(s,"img");1===i.length&&s.removeChild(i[0])}}}]),e}();t["default"]=x},33:function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(32),l=s(i);window.SortableTable||n(34),t["default"]=l["default"]},34:function(e,t,n){n(35)(n(36))},35:function(e,t){e.exports=function(e){"function"==typeof execScript?execScript(e):eval.call(null,e)}},36:function(e,t){e.exports='/*----------------------------------------------------------------------------\\\n| Sortable Table 1.12 |\n|-----------------------------------------------------------------------------|\n| Created by Erik Arvidsson |\n| (http://webfx.eae.net/contact.html#erik) |\n| For WebFX (http://webfx.eae.net/) |\n|-----------------------------------------------------------------------------|\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\n|-----------------------------------------------------------------------------|\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\n|-----------------------------------------------------------------------------|\n| Licensed under the Apache License, Version 2.0 (the "License"); you may not |\n| use this file except in compliance with the License. You may obtain a copy |\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\n| Unless required by applicable law or agreed to in writing, software |\n| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\n| License for the specific language governing permissions and limitations |\n| under the License. |\n|-----------------------------------------------------------------------------|\n| 2003-01-10 | First version |\n| 2003-01-19 | Minor changes to the date parsing |\n| 2003-01-28 | JScript 5.0 fixes (no support for \'in\' operator) |\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\n| | Using onclick DOM0 event if no support for addEventListener |\n| | or attachEvent |\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\n| | easier to add new, custom sort types. |\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\n| | Change defaultDescending to suit your needs. |\n| 2004-03-14 | Improved sort type None look and feel a bit |\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\n| | can use another tHead or no tHead, and you can chose some |\n| | other tBody. |\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\n|-----------------------------------------------------------------------------|\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\n\\----------------------------------------------------------------------------*/\n\n\nfunction SortableTable(oTable, oSortTypes) {\n\n this.sortTypes = oSortTypes || [];\n\n this.sortColumn = null;\n this.descending = null;\n\n var oThis = this;\n this._headerOnclick = function (e) {\n oThis.headerOnclick(e);\n };\n\n if (oTable) {\n this.setTable( oTable );\n this.document = oTable.ownerDocument || oTable.document;\n }\n else {\n this.document = document;\n }\n\n\n // only IE needs this\n var win = this.document.defaultView || this.document.parentWindow;\n this._onunload = function () {\n oThis.destroy();\n };\n if (win && typeof win.attachEvent != "undefined") {\n win.attachEvent("onunload", this._onunload);\n }\n}\n\nSortableTable.gecko = navigator.product == "Gecko";\nSortableTable.msie = /msie/i.test(navigator.userAgent);\n// Mozilla is faster when doing the DOM manipulations on\n// an orphaned element. MSIE is not\nSortableTable.removeBeforeSort = SortableTable.gecko;\n\nSortableTable.prototype.onsort = function () {};\n\n// default sort order. true -> descending, false -> ascending\nSortableTable.prototype.defaultDescending = false;\n\n// shared between all instances. This is intentional to allow external files\n// to modify the prototype\nSortableTable.prototype._sortTypeInfo = {};\n\nSortableTable.prototype.setTable = function (oTable) {\n if ( this.tHead )\n this.uninitHeader();\n this.element = oTable;\n this.setTHead( oTable.tHead );\n this.setTBody( oTable.tBodies[0] );\n};\n\nSortableTable.prototype.setTHead = function (oTHead) {\n if (this.tHead && this.tHead != oTHead )\n this.uninitHeader();\n this.tHead = oTHead;\n this.initHeader( this.sortTypes );\n};\n\nSortableTable.prototype.setTBody = function (oTBody) {\n this.tBody = oTBody;\n};\n\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\n if ( this.tHead )\n this.uninitHeader();\n this.sortTypes = oSortTypes || [];\n if ( this.tHead )\n this.initHeader( this.sortTypes );\n};\n\n// adds arrow containers and events\n// also binds sort type to the header cells so that reordering columns does\n// not break the sort types\nSortableTable.prototype.initHeader = function (oSortTypes) {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var doc = this.tHead.ownerDocument || this.tHead.document;\n this.sortTypes = oSortTypes || [];\n var l = cells.length;\n var img, c;\n for (var i = 0; i < l; i++) {\n c = cells[i];\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\n img = doc.createElement("IMG");\n img.src = "images/blank.png";\n c.appendChild(img);\n if (this.sortTypes[i] != null)\n c._sortType = this.sortTypes[i];\n if (typeof c.addEventListener != "undefined")\n c.addEventListener("click", this._headerOnclick, false);\n else if (typeof c.attachEvent != "undefined")\n c.attachEvent("onclick", this._headerOnclick);\n else\n c.onclick = this._headerOnclick;\n }\n else\n {\n c.setAttribute( "_sortType", oSortTypes[i] );\n c._sortType = "None";\n }\n }\n this.updateHeaderArrows();\n};\n\n// remove arrows and events\nSortableTable.prototype.uninitHeader = function () {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var l = cells.length;\n var c;\n for (var i = 0; i < l; i++) {\n c = cells[i];\n if (c._sortType != null && c._sortType != "None") {\n c.removeChild(c.lastChild);\n if (typeof c.removeEventListener != "undefined")\n c.removeEventListener("click", this._headerOnclick, false);\n else if (typeof c.detachEvent != "undefined")\n c.detachEvent("onclick", this._headerOnclick);\n c._sortType = null;\n c.removeAttribute( "_sortType" );\n }\n }\n};\n\nSortableTable.prototype.updateHeaderArrows = function () {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var l = cells.length;\n var img;\n for (var i = 0; i < l; i++) {\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\n img = cells[i].lastChild;\n if (i == this.sortColumn)\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\n else\n img.className = "sort-arrow";\n }\n }\n};\n\nSortableTable.prototype.headerOnclick = function (e) {\n // find TD element\n var el = e.target || e.srcElement;\n while (el.tagName != "TD")\n el = el.parentNode;\n\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\n};\n\n// IE returns wrong cellIndex when columns are hidden\nSortableTable.getCellIndex = function (oTd) {\n var cells = oTd.parentNode.childNodes\n var l = cells.length;\n var i;\n for (i = 0; cells[i] != oTd && i < l; i++)\n ;\n return i;\n};\n\nSortableTable.prototype.getSortType = function (nColumn) {\n return this.sortTypes[nColumn] || "String";\n};\n\n// only nColumn is required\n// if bDescending is left out the old value is taken into account\n// if sSortType is left out the sort type is found from the sortTypes array\n\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\n if (!this.tBody) return;\n if (sSortType == null)\n sSortType = this.getSortType(nColumn);\n\n // exit if None\n if (sSortType == "None")\n return;\n\n if (bDescending == null) {\n if (this.sortColumn != nColumn)\n this.descending = this.defaultDescending;\n else\n this.descending = !this.descending;\n }\n else\n this.descending = bDescending;\n\n this.sortColumn = nColumn;\n\n if (typeof this.onbeforesort == "function")\n this.onbeforesort();\n\n var f = this.getSortFunction(sSortType, nColumn);\n var a = this.getCache(sSortType, nColumn);\n var tBody = this.tBody;\n\n a.sort(f);\n\n if (this.descending)\n a.reverse();\n\n if (SortableTable.removeBeforeSort) {\n // remove from doc\n var nextSibling = tBody.nextSibling;\n var p = tBody.parentNode;\n p.removeChild(tBody);\n }\n\n // insert in the new order\n var l = a.length;\n for (var i = 0; i < l; i++)\n tBody.appendChild(a[i].element);\n\n if (SortableTable.removeBeforeSort) {\n // insert into doc\n p.insertBefore(tBody, nextSibling);\n }\n\n this.updateHeaderArrows();\n\n this.destroyCache(a);\n\n if (typeof this.onsort == "function")\n this.onsort();\n};\n\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\n var oThis = this;\n this._asyncsort = function () {\n oThis.sort(nColumn, bDescending, sSortType);\n };\n window.setTimeout(this._asyncsort, 1);\n};\n\nSortableTable.prototype.getCache = function (sType, nColumn) {\n if (!this.tBody) return [];\n var rows = this.tBody.rows;\n var l = rows.length;\n var a = new Array(l);\n var r;\n for (var i = 0; i < l; i++) {\n r = rows[i];\n a[i] = {\n value: this.getRowValue(r, sType, nColumn),\n element: r\n };\n };\n return a;\n};\n\nSortableTable.prototype.destroyCache = function (oArray) {\n var l = oArray.length;\n for (var i = 0; i < l; i++) {\n oArray[i].value = null;\n oArray[i].element = null;\n oArray[i] = null;\n }\n};\n\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\n // if we have defined a custom getRowValue use that\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\n\n var s;\n var c = oRow.cells[nColumn];\n if (typeof c.innerText != "undefined")\n s = c.innerText;\n else\n s = SortableTable.getInnerText(c);\n return this.getValueFromString(s, sType);\n};\n\nSortableTable.getInnerText = function (oNode) {\n var s = "";\n var cs = oNode.childNodes;\n var l = cs.length;\n for (var i = 0; i < l; i++) {\n switch (cs[i].nodeType) {\n case 1: //ELEMENT_NODE\n s += SortableTable.getInnerText(cs[i]);\n break;\n case 3: //TEXT_NODE\n s += cs[i].nodeValue;\n break;\n }\n }\n return s;\n};\n\nSortableTable.prototype.getValueFromString = function (sText, sType) {\n if (this._sortTypeInfo[sType])\n return this._sortTypeInfo[sType].getValueFromString( sText );\n return sText;\n /*\n switch (sType) {\n case "Number":\n return Number(sText);\n case "CaseInsensitiveString":\n return sText.toUpperCase();\n case "Date":\n var parts = sText.split("-");\n var d = new Date(0);\n d.setFullYear(parts[0]);\n d.setDate(parts[2]);\n d.setMonth(parts[1] - 1);\n return d.valueOf();\n }\n return sText;\n */\n };\n\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\n if (this._sortTypeInfo[sType])\n return this._sortTypeInfo[sType].compare;\n return SortableTable.basicCompare;\n};\n\nSortableTable.prototype.destroy = function () {\n this.uninitHeader();\n var win = this.document.parentWindow;\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\n win.detachEvent("onunload", this._onunload);\n }\n this._onunload = null;\n this.element = null;\n this.tHead = null;\n this.tBody = null;\n this.document = null;\n this._headerOnclick = null;\n this.sortTypes = null;\n this._asyncsort = null;\n this.onsort = null;\n};\n\n// Adds a sort type to all instance of SortableTable\n// sType : String - the identifier of the sort type\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\n// string and casts it to a desired format. If left out the string is just\n// returned\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\n// compare function. Takes two values and compares them. If left out less than,\n// <, compare is used\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\n// that takes the row and the column index and returns the value used to compare.\n// If left out then the innerText is first taken for the cell and then the\n// fGetValueFromString is used to convert that string the desired value and type\n\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\n this._sortTypeInfo[sType] = {\n type: sType,\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\n compare: fCompareFunction || SortableTable.basicCompare,\n getRowValue: fGetRowValue\n };\n};\n\n// this removes the sort type from all instances of SortableTable\nSortableTable.prototype.removeSortType = function (sType) {\n delete this._sortTypeInfo[sType];\n};\n\nSortableTable.basicCompare = function compare(n1, n2) {\n if (n1.value < n2.value)\n return -1;\n if (n2.value < n1.value)\n return 1;\n return 0;\n};\n\nSortableTable.idFunction = function (x) {\n return x;\n};\n\nSortableTable.toUpperCase = function (s) {\n return s.toUpperCase();\n};\n\nSortableTable.toDate = function (s) {\n var parts = s.split("-");\n var d = new Date(0);\n d.setFullYear(parts[0]);\n d.setDate(parts[2]);\n d.setMonth(parts[1] - 1);\n return d.valueOf();\n};\n\n\n// add sort types\nSortableTable.prototype.addSortType("Number", Number);\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\nSortableTable.prototype.addSortType("String");\n// None is a special case\n'}});