Resizable table columns with jQuery
So I started writing my own, just bare bones functionality for now, will be working on it next week... http://jsfiddle.net/ydTCZ/
:-) Once I found myself in the same situation, there was no jQuery plugin matching my requeriments, so I spend some time developing my own one: colResizable
About colResizable
colResizable is a free jQuery plugin to resize table columns dragging them manually. It is compatible with both mouse and touch devices and has some nice features such as layout persistence after page refresh or postback. It works with both percentage and pixel-based table layouts.
It is tiny in size (colResizable 1.0 is only 2kb) and it is fully compatible with all major browsers (IE7+, Firefox, Chrome and Opera).
Features
colResizable was developed since no other similar plugin with the below listed features was found:
- Compatible with mouse and touch devices (PC, tablets, and mobile phones)
- Compatibility with both percentage and pixel-based table layouts
- Column resizing not altering total table width (optional)
- No external resources needed (such as images or stylesheets)
- Optional layout persistence after page refresh or postback
- Customization of column anchors
- Small footprint
- Cross-browser compatibility (IE7+, Chrome, Safari, Firefox)
- Events
Comparison with other plugins
colResizable is the most polished plugin to resize table columns out there. It has plenty of customization possibilities and it is also compatible with touch devices. But probably the most interesting feature which is making colResizable the greatest choice is that it is compatible with both pixel-based and fluid percentage table layouts. But, what does it mean?
If the width of a table is set to, lets say 90%, and the column widths are modified using colResizable, when the browser is resized columns widths are resized proportionally. While other plugins does behave odd, colResizable does its job just as expected.
colResizable is also compatible with table max-width attribute: if the sum of all columns exceed the table's max-width, they are automatically fixed and updated.
Another great advantage compared with other plugins is that it is compatible with page refresh, postbacks and even partial postbacks if the table is located inside of an updatePanel. It is compatible with all major browsers (IE7+, Firefox, Chrome and Opera), while other plugins fail with old IE versions.
See samples and JSFiddle.
Code sample
$("#sample").colResizable({
liveDrag:true
});