gajus / wholly

jQuery plugin used to select the entire table row and column in response to mouseenter and mouseleave events. Wholly supports table layouts that utilize colspan and rowspan.
http://gajus.com/sandbox/wholly/demo/
Other
201 stars 32 forks source link

Problem with wholly table which contains a datepicker table #7

Open RichardNeill opened 6 years ago

RichardNeill commented 6 years ago

I have a table which is highlighted by wholly, and that's great. However, inside some of the table cells, I am using the bootstrap datepicker, which generates its own table. If I click the datepicker, and then mouse-over the datepicker's tooltip, then every one of these cells generates this unhelpful console.log:

I don't actually need wholly to work within the embedded datepicker (indeed, it's best that it doesn't), but it would be nice to get rid of the error messages. Maybe we need a way to tell wholly that a table within a table should not be treated as inheriting the highlightable class?

RichardNeill commented 3 years ago

Here is the solution to this.

      table.on('mouseenter', 'td, th', function () {
            var target = $(this),
                rowspan = parseInt(target.attr('rowspan'), 10) || 1,
                colspan = parseInt(target.attr('colspan'), 10) || 1,
                offsetInMatrix = target.data('wholly.offsetInMatrix');

    //Avoid issues with programmatically generated tables in tempusdominus datepicker.
    if (typeof(offsetInMatrix) === "undefined"){
        //console.log ("Undefined offsetInMatrix, ignoring.");
        return;
    }