Focus on the Search input

Focus on the Search input

CharlyPoppinsCharlyPoppins Posts: 16Questions: 2Answers: 0
edited July 2012 in DataTables 1.9
Hi, I try to set the focus on the Search input of the dataTable when the page is load, but I didn't manage.

Is there a way to so this ?

Replies

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    http://live.datatables.net/exozoy/edit#javascript,html :-)

    Allan
  • CharlyPoppinsCharlyPoppins Posts: 16Questions: 2Answers: 0
    Thanks, but I'll already tried this and it didn't work.

    Now i figured out the problem.

    It work if :

    "oLanguage": {
    "sUrl": "../js/dataTables/fr_FR.txt"
    },

    is in comment. When I uncomment it, the focus don't work anymore.


    oTable = $('#liste').dataTable({
    "sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "server_processing.php",
    "iDisplayLength": 50,
    //"oLanguage": {
    // "sUrl": "../js/dataTables/fr_FR.txt"
    //},
    "aoColumnDefs": [
    { "bSortable": false, "bSearchable": false, "bVisible": true, "aTargets": [ 0 ] }
    ],
    "bStateSave": true,
    });

    $('#liste_filter input').focus();
This discussion has been closed.