tethys/public/js/dataTable.js

2 lines
152 KiB
JavaScript
Raw Permalink 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,a){"use strict";var r,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?oe(this[r.iApiIndex]):this)},this.fnAddData=function(e,n){var r=this.api(!0),o=t.isArray(e)&&(t.isArray(e[0])||t.isPlainObject(e[0]))?r.rows.add(e):r.row.add(e);return(n===a||n)&&r.draw(),o.flatten().toArray()},this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],r=n.oScroll;t===a||t?e.draw(!1):""===r.sX&&""===r.sY||Wt(n)},this.fnClearTable=function(t){var e=this.api(!0).clear();(t===a||t)&&e.draw()},this.fnClose=function(t){this.api(!0).row(t).child.hide()},this.fnDeleteRow=function(t,e,n){var r=this.api(!0),o=r.rows(t),l=o.settings()[0],i=l.aoData[o[0][0]];return o.remove(),e&&e.call(this,l,i),(n===a||n)&&r.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,r,o,l){var i=this.api(!0);null===e||e===a?i.search(t,n,r,l):i.column(e).search(t,n,r,l),i.draw()},this.fnGetData=function(t,e){var n=this.api(!0);if(t!==a){var r=t.nodeName?t.nodeName.toLowerCase():"";return e!==a||"td"==r||"th"==r?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!==a?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 a=e.cell(t).index();return[a.row,a.columnVisible,a.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===a||e)&&n.draw(!1)},this.fnSetColumnVis=function(t,e,n){var r=this.api(!0).column(t).visible(e);(n===a||n)&&r.columns.adjust().draw()},this.fnSettings=function(){return oe(this[r.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,r,o){var l=this.api(!0);return n===a||null===n?l.row(e).data(t):l.cell(e,n).data(t),(o===a||o)&&l.columns.adjust(),(r===a||r)&&l.draw(),0},this.fnVersionCheck=r.fnVersionCheck;var n=this,l=e===a,i=this.length;for(var d in l&&(e={}),this.oApi=this.internal=r.internal,s.ext.internal)d&&(this[d]=Le(d));return this.each(function(){var r,o=i>1?se({},e,!0):e,d=0,u=this.getAttribute("id"),c=!1,f=s.defaults,p=t(this);if("table"==this.nodeName.toLowerCase()){B(f),k(f.column),T(f,f,!0),T(f.column,f.column,!0),T(f,t.extend(o,p.data()),!0);var h=s.settings;for(d=0,r=h.length;d<r;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!==a?o.bRetrieve:f.bRetrieve,g=o.bDestroy!==a?o.bDestroy:f.bDestroy;if(l||b)return m.oInstance;if(g){m.oInstance.fnDestroy();break}return void le(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 y=t.extend(!0,{},s.models.oSettings,{sDestroyWidth:p[0].style.width,sInstance:u,sTableId:u});y.nTable=this,y.oApi=n.internal,y.oInit=o,h.push(y),y.oInstance=1===n.length?n:p.dataTable(),B(o),_(o.oLanguage),o.aLengthMenu&&!o.iDisplayLength&&(o.iDisplayLength=t.isArray(o.aLengthMenu[0])?o.aLengthMenu[0][0]:o.aLengthMenu[0]),o=se(t.extend(!0,{},f),o),ie(y.oFeatures,o,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]),ie(y,o,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaS