Reputation: 1740
I have used a plugin to resize the columns in my html table. I am using the plugin available at http://quocity.com/colresizable/ To do so I m doing
$(".resizable").colResizable();
Its working perfectly. My table are dynamic and constantly needs to be refreshed. The issue is that for the first time the plugin runs perfectly fine, but the moment any table is reloaded/refreshed, the resizing does not work. Now I m looking to find a solution as to how to initialize the plugin again at each refresh of the table so taht every time the table is refreshed it again makes the columns resizable. Please let me know if any thing is not understandable. Thanks in Advance
Upvotes: 0
Views: 628
Reputation: 782148
Calling .colResizable()
after adding the new table works for me.
$(function() {
$("#addtable").click(function() {
if ($("#sample3").length > 0) {
$("#sample3").colResizable({
disable: true
});
}
$("#newtable").html('<table id="sample3" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><th>header</th><th>header</th><th>header</th></tr><tr><td class="left">cell</td><td>cell</td><td class="right">cell</td></tr><tr><td class="left">cell</td><td>cell</td><td class="right">cell</td></tr><tr><td class="left bottom">cell</td><td class="bottom">cell</td><td class="bottom right">cell</td></tr></table>');
$("#sample3").colResizable({
liveDrag: true,
gripInnerHtml: "<div class='grip'></div>",
draggingClass: "dragging"
});
});
});
See FIDDLE
Upvotes: 2