Some ColReorderWithResize OR Column resizing questions

Some ColReorderWithResize OR Column resizing questions

GregPGregP Posts: 487Questions: 8Answers: 0
edited October 2011 in Plug-ins
Okee dokee. Let me start off by stating my overall goal: to be able to resize columns. I do NOT have reordering as a requirement. That said, ColReorderWithResize was easy to implement and basically works.

If anyone knows a different jQuery plugin that can resize without reorder, and is easily implemented, that might be a better option than addressing everything below:

---

The target area to get the "resize" handle is only 1 pixel wide, so I adjusted it (line 643 as of this writing):

[code]
if (e.pageX == Math.round(offset.left + nLength)) // old
if (e.pageX >= Math.round(offset.left + nLength)-2) // new
[/code]

Might be handy for someone out there. It only grows the 'handle' range to the left of the divider, but it's still better than nothing.

There remain some problems I'm having a hard time solving, though:

1. It actually would be nice to grow the range to the right, too, but when you hover to the right of the divider, you're into a new listener element. I can't figure out how to insert code for "I know the mouse is in the new element, but since it's only 2 pixels from the right, make the target object the previous th instead". Totally generally speaking, it would work out to something like:

[code]
if (e.pageX < Math.round(offset.left)+2) {
target = $(nTh).prev();
}
[/code]

But the problem is that there's no "target", there's just nTh. And as far as I can tell, you can't just redefine nTh. Or can you? [update: I may have been wrong; there's an nThTarget that might be used... I have to dig deeper]

2. I don't know how to disable the column reordering. In certain scenarios, reordering is breaking the table and I don't have time to trouble-shoot so I'd rather just disable for now. But the resizing and reordering are tightly coupled into the same event handler, so I'm not sure how to separate one from the other. I tried removing the "else this is not a resize" code, but I'm missing a property, 'x' that is used elsewhere in the function.

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Just some advertising for my plugin :)

    http://datatables.net/forums/discussion/8471/column-resize-plugin
This discussion has been closed.