Tab between columns for select fields

Tab between columns for select fields

RammohanRammohan Posts: 1Questions: 0Answers: 0

I have set of columns which are of type select. and i want to open the drop down list values(all the values from drop down) when i am using the tab key from keyboard (want to open the drop down list same as by using mouse click). Could you please suggest how to resolve this issue.

e.g. datatable editor script

     var ItemsEditorConfig = {
     "ajax": "EditServlet",
    "table": "#items",
    "fields": [ 
        {       /* NOTE!!! This field appears in the EDITOR, so the value can be captured, but NOT in the Data Table so it cannot be changed! */
            label: "ID",       
            name: "JobId"
        },
        {
            label: "Job #",
            name: "JobNumber",
            attr: { maxlength: 50 }
        },  {
            label: "Description",
            name: "JobDescription",
            attr: { maxlength: 255 }
        }, {
            label: "Type",
            name: "TypeOfConstruction",
            type: "select",
            options: [ 
                "Test1",
                "Test2",
                "Test3",
                "Test4",
                "Test5",
                "Test6"
            ]
        }

java script code to handle the tab key functionality.

if ( e.keyCode === 9 ) {
e.preventDefault();

                                // Find the cell that is currently being edited
                                var cell = $('div.DTE').parent();

                                if ( e.shiftKey && cell.prev().length && 
                                     cell.prev().index() >= 0 ) {    // using ' }!== 0 )' eliminates 1st column from editing {
                                    // One cell to the left (skipping the first column)

                                    if (cell.prev().index() === 5 ) {     
                                        cell.prev().prev().prev().click();
                                    } else if ( ( cell.prev().index() === 9  && skipInputField === 9 ) ||
                                                ( cell.prev().index() === 8  && skipInputField === 8 )) {
                                            // logOnConsole("NON EDITABLE FIELD "+cell.index());
                                            cell.prev().prev().click();
                                    } else {
                                        cell.prev().click();
                                    }
                                }
                                else if ( e.shiftKey ) {
                                    // Up to the previous row
                                    cell.parent().prev().children().last(0).click();
                                }
                                else if ( cell.next().length ) {
                                    // One cell to the right
                                    if (cell.next().index() === 4 ) {      
                                        cell.next().next().next().click();     //cell.next().index(6).click();  //cell.nextAll('.editable');  does NOT work
                                    } else if ( (cell.next().index() === 9 && skipInputField === 9) ||
                                                (cell.next().index() === 8 && skipInputField === 8) ) {
                                            //cell.next( cell.next(9).click();   //cell.next().index(10).click();
                                            //logOnConsole("NON EDITABLE FIELD "+cell.index());
                                        cell.next().next().click();
                                    } else {
                                        cell.next().click();
                                    }
                                }
                                else {
                                    // Down to the next row
                                    cell.parent().next().children().eq(0).click();  // use .eq(1) to skip first column
                                }
                           }
This discussion has been closed.