3

I want to develop a table with the ability to resize columns by clicking and dragging (I have done this using ColReorderWithResize plugin).

However, when I use scroll option and I try to resize the header column, the table is not getting aligned with the header when the header is resized.

Here is a fiddle script.

What I would like is that if I resize header column (e.g. Browser column) then the body column should align with header column. Is this normal behaviour in ColReorderWithResize when I want to use a scrollbar?

Note I am using:

DataTables 1.9.4

ColReorderWithResize 1.0.7

var $table = $("#demo table");
$table.dataTable({
  "sDom": "Rlfrtip",
  "sScrollY":($(window).height() - 300) + "px",

  "fnDrawCallback": function() {
    $(window).unbind('resize').bind('resize', function () {
      that.applyTableHeight();
    });
  },
  applyTableHeight:function () {
    var sScrollY = ($(window).height() - this.staticHeight) + "px";
    $(".dataTables_scrollBody").css("height", sScrollY);
    this.calculateTableWidth();
  }
});

2 Answers 2

1

just try this .. redraw the datatable it will effect.

$("#table_id").dataTable().fnDraw();

Sign up to request clarification or add additional context in comments.

Comments

0
$("#tblname").dataTable({
        autoWidth: false,
        oLanguage: {"sZeroRecords": ' ', "sEmptyTable": ' ' },
        select: true,
        scrollY:        500,
        scrollX:        false,
        deferRender:    true,
        scroller:       false,
        paging:   false,
        ordering: false,
        info:     false
    });
 $(window).resize(function() {
        $("#tblname").dataTable().fnDraw();
                 });

This resolved my problem if you use datatables and scroll plugin.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.