So I\'m trying to use the flexigrid plugin. It looks like it\'s going to work great aside from the fact that it looks like you have to manually set the column widths. Otherwis
This code work fine in my project. It's similar to other answers.
$("#my_table").flexigrid({
...
onSuccess: function(){
columnWidth();
$(window).resize(function(){
columnWidth();
});
}
});
function columnWidth(){
var num_col = 0;
//Work with the columns width of the first row of body
$("#row1 td").each(function(td){
//row's column's width greater than header's column's width
if($(this).width() > $("th[axis='col"+num_col+"']").width()){
$("th[axis='col"+num_col+"']").width($(this).width());
$("th[axis='col"+num_col+"']").css({"min-width":$(this).width()});
}
//header's column's width greater than row's column's width
else if($("th[axis='col"+num_col+"']").width() > $(this).width()){
$("td[abbr='"+$(this).prop('abbr')+"']").width($("th[axis='col"+num_col+"']").width());
$("td[abbr='"+$(this).prop('abbr')+"']").css({"min-width":$("th[axis='col"+num_col+"']").width()});
}
++num_col;
});
}
I hope this has solved your problems.