/* * bootstrap-table - v1.12.1 - 2018-03-12 * https://github.com/wenzhixin/bootstrap-table * Copyright (c) 2018 zhixin wen * Licensed MIT License */ !function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"}),a.extend(a.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.showToolbar||this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['
','",'","
"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['
  • ','',c[b],"","
  • "].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){if(d.options.exportFooter){var c=d.getData(),e=d.$tableFooter.find("tr").first(),f={},g=[];a.each(e.children(),function(b,c){var e=a(c).children(".th-inner").first().html();f[d.columns[b].field]=" "==e?null:e,g.push(e)}),d.append(f);var h=d.$body.children().last();a.each(h.children(),function(b,c){a(c).html(g[b])})}d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1})),d.options.exportFooter&&d.load(c)},e=d.header.stateField;if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("server"===d.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){e&&d.hideColumn(e),c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var f=d.getData(),g=d.getSelections();if(!g.length)return;if("server"===d.options.sidePagination){var h={total:d.options.totalRows};h[d.options.dataField]=f,f=h;var i={total:g.length};i[d.options.dataField]=g,g=i}d.load(g),e&&d.hideColumn(e),c(),d.load(f)}else e&&d.hideColumn(e),c();e&&d.showColumn(e)})}}}}(jQuery);