I have a dynamic table in which the user can add rows or columns, I also use colResizable to make it flexible so that the user can resize the columns. Although I added this plugin, it does not work for newly created cells.
This is my source
$(document).ready(function() {
$( "#container table" ).colResizable({ liveDrag : true });
}
This function to create a column
function insert_column(element, position)
{
element.parent().parent().find('tr').each(function() {
var index = 0;
$(this).find('td').each(function() {
if (index == position)
{
$(this).after('<td> </td>');
}
index++;
});
});
$( "#container table" ).colResizable({ liveDrag : true });
}
If you want, you can think about it because of some CSS, this is the only CSS that I have for #containerand the tables inside
#container {
float: left;
width:800px;
height:100%;
overflow:hidden;
padding: 7px;
border: 2px #BBB dashed;
}
#container table {
width: 100%;
table-layout: fixed;
background-color:#FCFCFC;
}
#container td {
border-spacing: 2px;
min-height: 17px;
min-width: 50px;
border: 1px #CCC dotted;
}
The strange part is that if I comment or delete colResizable, it works to add columns, but if I turn it on, it adds columns, but it doesn’t appear and cannot be changed. Any help would be appreciated.