Closed
Description
may be this will help somebody, Click on column header and drag to another column to rearrange columns. may be can be added to the widgets common file, checked across chrome & IE decent performance over 50 sample records. only checked with the bootstrap theme though
may be can write a small CSS.for dragging purpsoe
$.tablesorter.addWidget({
id: 'col-reorder',
init: function(table, thisWidget) {
var wo = table.config.widgetOptions;
$(table).find('thead th').mouseup(function() {
var endNdx=$(this).index();
if((wo.startColNdx != endNdx) && (wo.startColNdx >-1) && (endNdx>-1)) {
var rows = jQuery('thead tr, tbody tr', $(table));
var cols,colFrom,colTo;
if((wo.startColNdx<endNdx) && ((endNdx-wo.startColNdx))==1) {
colFrom = endNdx;
colTo = wo.startColNdx;
}else {
colFrom = wo.startColNdx;
colTo = endNdx;
}
rows.each(function() {
cols = jQuery(this).children('th, td');
cols.eq(colFrom).detach().insertBefore(cols.eq(colTo));
});
}
wo.startColNdx=-1;
}).mousedown(function(){
wo.startColNdx = $(this).index();
});
},
format: function(table, init){
},
remove: function(table, c, wo){
}
});