tethys/public/js/dataTable.js

2 lines
154 KiB
JavaScript
Raw Normal View History

!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],(function(e){return t(e,window,document)})):"object"==typeof exports?module.exports=function(e,n){return e||(e=window),n||(n="undefined"!=typeof window?require("jquery"):require("jquery")(e)),t(n,e,e.document)}:t(jQuery,window,document)}((function(t,e,n,r){"use strict";var a,o,l,i,s=function(e){this.$=function(t,e){return this.api(!0).$(t,e)},this._=function(t,e){return this.api(!0).rows(t,e).data()},this.api=function(t){return new o(t?le(this[a.iApiIndex]):this)},this.fnAddData=function(e,n){var a=this.api(!0),o=Array.isArray(e)&&(Array.isArray(e[0])||t.isPlainObject(e[0]))?a.rows.add(e):a.row.add(e);return(n===r||n)&&a.draw(),o.flatten().toArray()},this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],a=n.oScroll;t===r||t?e.draw(!1):""===a.sX&&""===a.sY||zt(n)},this.fnClearTable=function(t){var e=this.api(!0).clear();(t===r||t)&&e.draw()},this.fnClose=function(t){this.api(!0).row(t).child.hide()},this.fnDeleteRow=function(t,e,n){var a=this.api(!0),o=a.rows(t),l=o.settings()[0],i=l.aoData[o[0][0]];return o.remove(),e&&e.call(this,l,i),(n===r||n)&&a.draw(),i},this.fnDestroy=function(t){this.api(!0).destroy(t)},this.fnDraw=function(t){this.api(!0).draw(t)},this.fnFilter=function(t,e,n,a,o,l){var i=this.api(!0);null===e||e===r?i.search(t,n,a,l):i.column(e).search(t,n,a,l),i.draw()},this.fnGetData=function(t,e){var n=this.api(!0);if(t!==r){var a=t.nodeName?t.nodeName.toLowerCase():"";return e!==r||"td"==a||"th"==a?n.cell(t,e).data():n.row(t).data()||null}return n.data().toArray()},this.fnGetNodes=function(t){var e=this.api(!0);return t!==r?e.row(t).node():e.rows().nodes().flatten().toArray()},this.fnGetPosition=function(t){var e=this.api(!0),n=t.nodeName.toUpperCase();if("TR"==n)return e.row(t).index();if("TD"==n||"TH"==n){var r=e.cell(t).index();return[r.row,r.columnVisible,r.column]}return null},this.fnIsOpen=function(t){return this.api(!0).row(t).child.isShown()},this.fnOpen=function(t,e,n){return this.api(!0).row(t).child(e,n).show().child()[0]},this.fnPageChange=function(t,e){var n=this.api(!0).page(t);(e===r||e)&&n.draw(!1)},this.fnSetColumnVis=function(t,e,n){var a=this.api(!0).column(t).visible(e);(n===r||n)&&a.columns.adjust().draw()},this.fnSettings=function(){return le(this[a.iApiIndex])},this.fnSort=function(t){this.api(!0).order(t).draw()},this.fnSortListener=function(t,e,n){this.api(!0).order.listener(t,e,n)},this.fnUpdate=function(t,e,n,a,o){var l=this.api(!0);return n===r||null===n?l.row(e).data(t):l.cell(e,n).data(t),(o===r||o)&&l.columns.adjust(),(a===r||a)&&l.draw(),0},this.fnVersionCheck=a.fnVersionCheck;var n=this,l=e===r,i=this.length;for(var d in l&&(e={}),this.oApi=this.internal=a.internal,s.ext.internal)d&&(this[d]=Re(d));return this.each((function(){var a,o=i>1?de({},e,!0):e,d=0,u=this.getAttribute("id"),c=!1,f=s.defaults,p=t(this);if("table"==this.nodeName.toLowerCase()){k(f),N(f.column),_(f,f,!0),_(f.column,f.column,!0),_(f,t.extend(o,p.data()),!0);var h=s.settings;for(d=0,a=h.length;d<a;d++){var m=h[d];if(m.nTable==this||m.nTHead&&m.nTHead.parentNode==this||m.nTFoot&&m.nTFoot.parentNode==this){var b=o.bRetrieve!==r?o.bRetrieve:f.bRetrieve,y=o.bDestroy!==r?o.bDestroy:f.bDestroy;if(l||b)return m.oInstance;if(y){m.oInstance.fnDestroy();break}return void ie(m,0,"Cannot reinitialise DataTable",3)}if(m.sTableId==this.id){h.splice(d,1);break}}null!==u&&""!==u||(u="DataTables_Table_"+s.ext._unique++,this.id=u);var g=t.extend(!0,{},s.models.oSettings,{sDestroyWidth:p[0].style.width,sInstance:u,sTableId:u});g.nTable=this,g.oApi=n.internal,g.oInit=o,h.push(g),g.oInstance=1===n.length?n:p.dataTable(),k(o),A(o.oLanguage),o.aLengthMenu&&!o.iDisplayLength&&(o.iDisplayLength=Array.isArray(o.aLengthMenu[0])?o.aLengthMenu[0][0]:o.aLengthMenu[0]),o=de(t.extend(!0,{},f),o),se(g.oFeatures,o,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]),se(g,o,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sSe