I have a problem with the new version keytable

I have a problem with the new version keytable

marcondomarcondo Posts: 13Questions: 3Answers: 0

My old code....

keysTable = new $.fn.dataTable.KeyTable(oTable);

keysTable.event.action( null, null, function( node ) {   
    //debugger;
    //return false;
    if(node.getAttribute('class').indexOf('xcl'))
    {
        //Blur focus
        keysTable.fnBlur(); 
        $(node).EditCell();

    }
    event.preventDefault();        
} );

--- New code

keysTable = $(oTable).DataTable( {    
    keys: true
} );
  keysTable.on( 'key', function ( e, datatable, key, cell, originalEvent ) {
    //debugger;
    //return false;
    if(node.getAttribute('class').indexOf('xcl'))
    {
        keysTable.Blur(); 
        $(e).EditCell();

    }
    originalEvent.preventDefault();        
} );

But not me any solution work? I find relatives examples
Thanks in advance

Answers

  • marcondomarcondo Posts: 13Questions: 3Answers: 0

    Sorry
    node=e
    if(e.getAttribute('class').indexOf('xcl'))

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Is 'key' a valid event? I thought it was 'keypress', 'keyup', 'keydown'.

    If key is a valid event, what is the problem?

  • marcondomarcondo Posts: 13Questions: 3Answers: 0

    I can not find documentation that is 'key'

  • marcondomarcondo Posts: 13Questions: 3Answers: 0

    e is de old event?

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Then why are you trying to apply a function to that event? Line 4 of your new code is not going to do anything.

  • marcondomarcondo Posts: 13Questions: 3Answers: 0

    Da igual hay nada Funciona volvere a la anterior versión, gracias

  • marcondomarcondo Posts: 13Questions: 3Answers: 0

    I got this to work to full .. but...
    Now I have a problem with fnBlur does not work as before and tested blur () of cell either not going on

    var objTable = $("#" + objMenuds).DataTable();
    keysTable = new $.fn.dataTable.KeyTable(objTable);
    objTable.on('key', function (e, datatable, key, cell, originalEvent) {
        if (key === 13) {
             if(cell.node().getAttribute('class').indexOf('xcl'))
             {
                 var cellNw = $(cell.node());
                 cellNw.blur(); // I need to lose focus
                 // Old programation keysTable.fnBlur();
                 cellNw.EditCell(); // This Works in depuration mode
             }
        }
    });
    

    any suggestions? Tanks

This discussion has been closed.