/** * Created by Jacky.gao on 2016/9/18. */ import Col from './Col.js'; export default class CustomCol extends Col{ constructor(table,name,width){ super(table); this.customCells=[]; this.name=name; this.width=width || 160; this.type='custom'; this.init(); } init(){ const _this=this; this.td=$(`${this.name}`); const del=$(""); this.td.append(del); del.click(function () { bootbox.confirm("真的要删除当前列?",function (result) { if(!result)return; _this.remove(); }); }); this.td.append(this.buildColResizeTrigger()); for(let row of this.scoreCardTable.attributeRows){ row.addCustomCol(this); } this.scoreCardTable.headerRow.append(this.td); this.bindColResize(); } remove(){ for(let row of this.scoreCardTable.attributeRows){ row.removeCustomCol(this); } const pos=this.scoreCardTable.customCols.indexOf(this); this.scoreCardTable.customCols.splice(pos,1); for(let cell of this.customCells){ cell.td.remove(); } this.td.remove(); window._setDirty(); } toXml(){ let xml=""; return xml; } }