Focus problem when using DataTable with KeyTable with JQueryUI modal form

Focus problem when using DataTable with KeyTable with JQueryUI modal form

dannybdannyb Posts: 4Questions: 0Answers: 0
edited December 2011 in KeyTable
Hi all

I am using DataTables with KeyTables. on the "action" event, I open a JQueryUI modal dialog with a form in it.

The first input field of the form is focused, as expected and desired. If I now start typing letters - all is well.

But using the , , , and keys still affects the table, not the form.

This behavior stops only if I click on the form with the mouse. I don't want to make the user do that, because the whole application is based on the ability to use the keyboard only.

So, how do I tell KeyTable to let go of the special keys listeners once the modal dialog is opened?
How can i give the focus back to KeyTable once the dialog is closed?

Thanks
Danny

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Danny,

    What you need to do is use the KeyTables instance property 'block' to stop KeyTables taking action on key presses. For example:

    [code]
    // Set up the KeyTable
    var keys = new KeyTable( {
    "table": document.getElementById('example')
    } );

    // Block all keyboard input to KeyTable
    keys.block = true;
    [/code]

    Obviously the example is a little pointless as you would want to put the blocker in the block where you display the dialogue, and an unblock when you close the dialogue, but the 'block' parameter the the main thing here :-)

    Regards,
    Allan
This discussion has been closed.