Conflict on Column Reorder to add additional DOM events (Column Resize) on the headers

Conflict on Column Reorder to add additional DOM events (Column Resize) on the headers

ArresvilleArresville Posts: 3Questions: 1Answers: 0

One of our requirements was to make sure that column resize and reorder works in the data grids. We were able to finally make resizing work in our datatable 1.10 but at the moment since Column Reorder takes the whole TH for reordering, we have to toggle it off to make resizing work, then turn it on only when they want to reorder their columns.

I don't want to mess up the colReorder plugin since it might be in conflict with future updates.
How the th looks on our implementation is this <th>

text

<span class='resizer'></span></th>. I've added a whole drag event on the whole container to prevent default and stop propagation so it wouldn't trigger any sort event if the mouse goes over on the sort on the header.

Is it possible to change the colReorder event to target the

<

div> instead of the whole <th> so it wouldn't conflict with the resizer event?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Unfortunately there is no supported column resizing extension currently available. There is a third party one that can be used, but it isn't supported by us I'm afraid.

    That said, if you want to modify ColReorder slightly to target a element element inside your header cells, this is the line to change - something like $('span.myReorderHandle', nTh) would do it.

    Allan

  • ArresvilleArresville Posts: 3Questions: 1Answers: 0

    Hi Allan, thanks for that, will make it simpler

    So far, we've made column resizing possible on 1.10 with no funky behaviors
    We just apply them on drawcallback and save the new column width values on localstorage so it save states.

    I can try make it as a plugin instead of just applying it after dt is drawn.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Great to hear! Adding this ability is probably one of the most requested features, so it is something that we need to think about adding!

    Allan

  • ArresvilleArresville Posts: 3Questions: 1Answers: 0

    I'd be glad to help, I'll keep you posted once I am done, just currently working on our huge project at the moment. Hopefully i can work on it this weekend.

This discussion has been closed.