ColReorder doesn't like columns with no caption

ColReorder doesn't like columns with no caption

richardprichardp Posts: 10Questions: 0Answers: 0
edited January 2012 in Bug reports
If you have a column without a caption, the DIV inside the TH shrinks to nothing so you end up clicking the TH instead of the DIV. The following line in _fnMouseDown
[code]
var nThTarget = e.target.nodeName == "TH" ? e.target : $(e.target).parents('TH')[0];
[/code]
will normally find the appropriate TH fine because jQuery's parents() function is case insensitive, whereas the comparison between nodeName and "TH" is case sensitive. And this becomes a problem when the DIV shrinks to nothing because of no caption and you click on the TH directly.

The solution is simple: force the case to either uppercase or lowercase. I used lowercase because it's more consistent and I don't like my TH's shouting at me! :)

Modified code:
[code]
var nThTarget = e.target.nodeName.toLowerCase() == "th" ? e.target : $(e.target).parents('th')[0];
[/code]
This discussion has been closed.