How to drag Whole column instead of only table header in colReorder?

How to drag Whole column instead of only table header in colReorder?

sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

Hi,
I want to drag whole column instead of column header in datatable as shown in colReorder example.

I want to do something like this:-
http://www.danvk.org/wp/dragtable/

You can move whole column in place of column header in that.

how can it is possible in datatable using colReorder.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Sorry no, This is not currently a feature of ColReorder.

    Allan

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    Ok thanks allan
    But is there any way to do it.
    by using other api.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    No sorry. As I said, that is not a feature that is present in ColReorder at this time. If there was an option for it, I would have mentioned it :-)

    Allan

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    OK Allan Thanks for your reply :)

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    Hi Allan,

    First of all thanks for your quick response.

    I appreciate it.

    I made some changes in js file and i finally made it.

    Please check it.

    http://projects.developmentshowcase.com/demo/multilang.php

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Fantastic - thanks for sharing this! Happy to accept a pull request with the change, if it supports scrolling tables, which I suspect will be the difficult part.

    Allan

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    Hello Allan,

    Thank you so much :).

    it will also work in scrolling table, the whole column is moving :- http://projects.developmentshowcase.com/demo/multilang.php

    In horizontal scroll, auto scrolling might be a issue but we can find solution of it by using below link:-
    https://jsfiddle.net/bababalcksheep/gsf2r1v4/17/

    BTW i don't know how to pull request as you said, Sorry for that.

    But i am writing a blog regarding of that. I will provide it to you in near time

    Sunil Parmar.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Hi Sunil,

    Super thanks! The problem with the scrolling aspect is that the whole column is shown on drag. That's not too bad visually in your example with a little bit of scrolling, but it wouldn't look right if there was a lot of content hidden, or the table is scrolled into the middle of the table.

    Allan

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    Hi Allan,

    I am back with new query.

    I hope you are fine.

    I want to do something like on click on the pdf,excel,csv export button or custom button one popup form will open, in that i need to check particular column which are in datatable , after submit the form just only selected columns are allow to export.

    Is it feasible.

    Can you help me please.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    Currently no. There is no way to stop the export buttons from exporting. You would need to modify them in order to perform the conditional logic you require and then save the file.

    You could potentially create a custom button that would call the action method of the export buttons - that would probably be the easiest way of doing it, but there is no built in way of doing it.

    Allan

  • sunilnimblesunilnimble Posts: 9Questions: 1Answers: 0

    okay, Thanks Allan.

  • ujwolujwol Posts: 3Questions: 1Answers: 0
    edited February 2017

    HI Sunil,
    I tried to open your link but it wouldn't work. Did you find any solution of this issue?
    Thanks

  • ujwolujwol Posts: 3Questions: 1Answers: 0
    edited February 2017

    hi allan,

    When we drag column can we force th to not move top or bottom of its original area?
    can we limit position of th in between blue lines like in image.

    Thank you

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Currently no, there isn't an option for that I'm afraid. That would require a modification in the source code.

    Allan

  • ekarolakekarolak Posts: 1Questions: 0Answers: 0
    edited April 2020

    I made it with few minor source code modifications. :)
    Was pretty simple to do. There may be things I did not thought about, but code presented below served my needs.
    Feel free to use that or implement into Datatables/ColReorder source code.

    https://pastebin.com/WwbfDuuB

This discussion has been closed.