KeyTable events are fired with the wrong Node arg

KeyTable events are fired with the wrong Node arg

dvilaverdedvilaverde Posts: 7Questions: 0Answers: 0
edited December 2009 in General
Hi,

I don't know if this is a defect with KeyTable or with something I am doing. Basically I've setup keyTable on a dataTable with full_numbers pagination and I have event listener like:

mKeyTable.event.focus(null, i, _focus);

and when the focus event is fired on the first page, all is well, but if I page to the second page and click on the first row, then the focus event is fired with the node from the first page with the same coords.

It seems like the method _fnEventFire in KeyTable calls _fnCellFromCoords which returns the incorrect node, but the _fnSetFocus method was called with the correct node for the nTarget arg, so it seems like something is getting lost along the way.

Dave

Dave

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Dave,

    Good spotting that! The function _fnCoordsFromCell() wasn't really suited for use with DataTables, so I've just fixed this. You can download v1.1.1 of KeyTable from http://sprymedia.co.uk/software/KeyTable/KeyTable.1.1.1.zip . I've tested the fix with the following (and modifications of it), which is fairly close to your code, so hopefully this would work well now:

    [code]
    $(document).ready( function () {
    var oTable = $('#example').dataTable();

    var keys = new KeyTable( {
    "table": document.getElementById('example'),
    "datatable": oTable
    } );

    keys.event.focus(null, 11, function(n, x, y){
    n.style.backgroundColor = "red";
    });
    } );
    [code]
    Hope this helps,
    Allan
This discussion has been closed.