Column resize plugin

Column resize plugin

koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
edited February 2012 in Plug-ins
Based on the http://datatables.net/extras/thirdparty/ColReorderWithResize/, I created a Column resize plugin. Can you help me test it?

It can be downloaded from https://github.com/koosvanderkolk/DataTables.columnResizer

1) Make sure the table headers have a right border of about 3px. These borders are the 'handlers' by which the columns can be resized.
2) Put a 'z' in your dataTables config to enable the resizing $(tableElement).dataTable( {"sDom": 'zrtSpi'});

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    edited February 2012
    See below for example
  • allanallan Posts: 61,686Questions: 1Answers: 10,100 Site admin
    Brilliant! Really nicely done :-)

    I guess the obvious issue is with the fact that the table is inherently constrained to the width of the container - so columns basically have a maximum size they can be and reduce the size of other columns. It might be possible to integrate this with x-scrolling, so as columns are made bigger the table will start to x-scroll - likewise if they are made smaller then the table can be smaller than the container. This might be a little trick, and might not always be what is wanted, but possibly an enhancement

    Thanks for sharing your work with us - this is really great!

    Regards,
    Allan
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    I was just thinking that it would make my example stronger if I would :)

    http://live.datatables.net/utagab/5/edit
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    By the way, Allan, is there a better way to add the plugin to the DataTable? Adding this 'z' to sDom feels a bit weird for me, because there is not really something added to the DOM (I just copied it from the original plugin).

    If would find it more logical to have some setting, e.g. 'enableColumnResizing' or something...
  • allanallan Posts: 61,686Questions: 1Answers: 10,100 Site admin
    Heh - nice one! I think I'll be linking to this post soon :-)

    Regarding the 'z' parameter - you are correct it is a little odd, but it the way that feature plug-ins currently work for DataTables. sDom can be used for non-DOM manipulation features such as your own, and Scroller etc, while it can also be used for others such as TableTools etc.

    v1.10 will see a bit of work on sDom to make it more intuitive and sensible for this kind of feature.

    Regards,
    Allan
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    [quote] I think I'll be linking to this post soon :-)[/quote]

    Cool! :)
  • sprockettsprockett Posts: 12Questions: 0Answers: 0
    koosvdkolk, this is brilliant: )

    I really enjoy this code! However, I am unable to get the statesaving to work... Has it been implemented yet?

    Would it also be possible to some how make this compatible with ColReorder? It would ideal to have both of these at the same time :)

    Thanks !
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    http://datatables.net/extras/thirdparty/ColReorderWithResize/
  • DriverDriver Posts: 23Questions: 0Answers: 0
    edited March 2012
    Works great, however I am unable to resize grouped columns (colspan). Also the headings do not fit into the cells after moving columns when colspan is used.
    It would be nice to make it work.
  • DriverDriver Posts: 23Questions: 0Answers: 0
    Any ideas how to fix it?
  • qeychonqeychon Posts: 1Questions: 0Answers: 0
    unfortunately ColReorderWithResize has a bug. You can not define the aiOrder argument anymore.
This discussion has been closed.