代码拉取完成,页面将自动刷新
/*!
* @author: lihaitao
* @webSite: http://blog.csdn.net/lhtzbj12/
* @version: v1.0.0
* @opensource:https://gitee.com/lhtzbj12/bootstrap-table-maintainColSwitch.js
* @description: 扩展Bootstrap-table插件,通过showColumns显示隐藏列时将设置保存到cookie或者数据库,下次打开时仍保持
*/
(function(c){c.extend(c.fn.bootstrapTable.defaults,{maintainColSwitch:false});var a=c.fn.bootstrapTable.Constructor,b=a.prototype.initTable;a.prototype.initTable=function(){var g=this;b.apply(this,Array.prototype.slice.apply(arguments));var d={initShowColumns:[],cookieKey:window.location.pathname.replace(/\/|\./g,"_")+"_colSwitch_"+g.$el.prop("id"),cookieExpires:7,onSave:function(h){return false},onLoad:function(){return false}};if(g.options.showColumns&&g.options.maintainColSwitch){g.options.maintainColSwitch=c.extend(d,g.options.maintainColSwitch)}else{return}var e=[];if(g.options.maintainColSwitch.initShowColumns.length>0){e=g.options.maintainColSwitch.initShowColumns}else{var f=c.cookie(g.options.maintainColSwitch.cookieKey);if(f){e=f.split("|")}}if(e.length>0){c(g.options.columns[0]).each(function(h,k){if(k.field==="state"){return true}var j=c(e).filter(function(i,l){return l===k.field});k.visible=j.length>0});if(g.options.maintainColSwitch.onLoad){g.options.maintainColSwitch.onLoad()}}g.$el.on("column-switch.bs.table",function(l,k,j){var i=c(this).bootstrapTable("getOptions");var h=c(i.columns[0]).map(function(m,n){return n.visible===true&&n.field!=="state"?n.field:null}).get();c.cookie(i.maintainColSwitch.cookieKey,h.join("|"),{expires:i.maintainColSwitch.cookieExpires});if(i.maintainColSwitch.onSave){i.maintainColSwitch.onSave(h)}});g.$el.on("load-success.bs.table",function(i){var h=g.$toolbar.find(".keep-open");if(e.length>0&&e.length<=g.options.minimumCountColumns){h.find("input:checked").prop("disabled",true)}})}})(jQuery);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。