Vertical menu with filter inside the sub-menu

Asked

Viewed 306 times

2

  • I added the comments here on the question. I hope I haven’t forgotten anything...

  • @Welguri try to do something with the dial contains. Only that he is case sensitive, use the lowercase like you did won’t help.

  • Then @Kaduamaral tried to base myself on the example that searches the table http://bootsnipp.com/snippets/featured/panel-table-with-filters-per-column ... for me this still too complex. :(

1 answer

1


You can create such a filter:

$('#filter').on('keyup', function(){

    var dataFilter = $(this);
    var valorBusca = dataFilter.val();
      var contaLetras = valorBusca.length;
       if (contaLetras >= 1) {
           filterData(valorBusca);
       } else {
        $('.navbar-nav li a').parent().show();  
       }

 function filterData(data) {

        $('.navbar-nav li a').each(function(iIndex, sElement) {
            $(sElement).parent().hide();  
            if (sElement.innerHTML.indexOf(data) !== -1) {
                 $(sElement).parent().show(); 
             }  
        });
} 

function retiraAcentos(palavra) {
    var com_acento = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ';
    var sem_acento = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC';
    var nova='';
    for(i=0;i<palavra.length;i++) {
        if (com_acento.search(palavra.substr(i,1))>=0) {
            nova+=sem_acento.substr(com_acento.search(palavra.substr(i,1)),1);
        }
        else {
            nova+=palavra.substr(i,1);
        }
    }
    return $.trim(nova).toLowerCase();
}

});

Here is the Jsfiddle: http://jsfiddle.net/ivanferrer/1L8Lc86s/1/

Here theme full version: http://jsfiddle.net/ivanferrer/1L8Lc86s/5/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.