I am using the accepted solution to this problem found here.
My goal is simply to have the table's row expand when clicked. This solution works great for me aside from one issue. Once a the expanded row is visible, if you click near the very bottom of the expanded row, the row will disappear and will not be able to be re-expanded. This is slightly different from the accepted solution. If you click the border under "name" after a row has been expanded, the solutions row will also disappear with no way to re-expand.
Here is the JS
function:
$(function() {
$("td[colspan=7]").find("p").hide();
$("table").click(function(event) {
event.stopPropagation();
var $target = $(event.target);
if ( $target.closest("td").attr("colspan") > 1 ) {
$target.slideUp();
} else {
$target.closest("tr").next().find("p").slideToggle();
}
});
});
I will try to provide additional information if needed.
My td
for only the expanding row has padding set to 0. If I give it some padding, clicking the padding, even before the row is expanded, will remove the whole expanding row.
EDIT To reproduce my issue click the border just under the 'N' of 'Name' in the previous solutions fiddle table after expanding a row.
EDIT Happens to my table if I click any part of the border.