Consistent grid headers with Flexigrid ?

前端 未结 12 1062
长发绾君心
长发绾君心 2021-02-03 10:05

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

12条回答
  •  花落未央
    2021-02-03 10:48

    My solution is a lot simpler than the others suggested.

    Before you call the flexigrid function, add this:

    $("#yourtable th").each(function() {
      $(this).attr("width", $(this).width());
    });
    

    This will set the width of the column headers to as wide as the text in them is (as opposed to manually setting each header width either with css or in the markup) and make the table body columns the same width.

提交回复
热议问题