ColReorder and FixedColumns Integration Problem

ColReorder and FixedColumns Integration Problem

aldrinaldrin Posts: 3Questions: 1Answers: 0

Does anyone have a solution for the ColReorder to work properly with FixedColumns?

The widths of the columns expand when you try to reorder them, as in this example.

Any help will be much appreciated. Thank you.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Thanks for flagging this up. I'll take a look into it as soon as I can.

    Allan

  • aldrinaldrin Posts: 3Questions: 1Answers: 0

    Thank you Allan and many thanks for the DataTables.

  • GlebstGlebst Posts: 2Questions: 0Answers: 0

    Hi Allan,

    I think there is a regexp bug in a folowing line:
    https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js#L594

    var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%])/);

    I guess it should be something like below instead

    var t = (th.attr('style') || '').match(/width:\s*(\d+(px|em|%))/);

    What it means is that sWidthOrig setting on column is getting a wrong value (trimmed "x" from the "px" setting, fo example "130p" instead of "130px") thus making columns to expand significantly. Changing the line as suggested helped me to get rid of this column reordering problem.

    Gleb

  • rcameronrcameron Posts: 2Questions: 0Answers: 0

    Hi Allan,

    Thanks again for your incredible support. Just about every issue I've had with setting up DataTables has been addressed personally by you in these forums. Awesome.

    I just wanted to check on your progress with this ColReorder + scrollX fix. Is there somewhere I can track its progress?

    Thank you, good sir.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Thanks for bumping this up - I've been meaning to take a look at it for a while.

    Two fixes needed:

    • The main error was in DataTables c8c619c0. A one character fix, but the result is that the column adjustment triggered by ColReorder works perfectly now.
    • The example was actually triggering a Javascript error 802cd4eb

    I'm going to be releasing DataTables 1.10.1 soon, and I'll also repackage ColReorder for a minor release as well. In the mean time, the nightly version on the downloads page is up to date with this fix.

    Allan

  • rcameronrcameron Posts: 2Questions: 0Answers: 0

    You're welcome, and thank you for getting back so quickly. I'll switch to the nightly should 1.10.1's release be a bit delayed. Cheers!

  • aldrinaldrin Posts: 3Questions: 1Answers: 0

    Thank you very much @allan... :)

This discussion has been closed.