Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Ariane Stela

[Resolvido] keydown no autocomplete

Recommended Posts

Olá galera,

 

É o seguinte, implementei o jquery.autocomplete no meu sistema mas nao estou conseguindo selecionar com o teclado o cliente e talz..

 

o .js está assim

 

jQuery(document).ready(function(){
    
    jQuery("#input_cliente").autocomplete('/search.php', {
        delay:10,
        minChars:1,
        matchSubset:1,
        matchContains:1,
        cacheLength:10,
        onItemSelect:selectItem,
        onFindValue:findValue,
        formatItem:formatItem
    });
}

function findValue(li) {
    if( li == null ) 
        return alert("No match!"); // if coming from an AJAX call, let's use the CityId as the value

    
    if( !!li.extra ) 
    {
        var sValue = li.extra[0]; // otherwise, let's just display the value in the text box
    }

    else 
        var sValue = li.selectValue; //alert("The value you selected was: " + sValue);

}

function selectItem(li) {
    preencherInputsById("#cli");
    findValue(li);
}

function selectPro(li){
    jQuery(".produto_select").val(li.extra);
    findValue(li);
}

alguém sabe algum parametro ou funçao para ativar o keydown e conseguir selecionar pelo teclado mesmo??

 

obrigada,

beijo

Compartilhar este post


Link para o post
Compartilhar em outros sites

$("#campo").keypress=function(){
    jQuery("#input_cliente").autocomplete('/search.php', {
        delay:10,
        minChars:1,
        matchSubset:1,
        matchContains:1,
        cacheLength:10,
        onItemSelect:selectItem,
        onFindValue:findValue,
        formatItem:formatItem
    });

}

seria isso?

Compartilhar este post


Link para o post
Compartilhar em outros sites

$("#campo").keypress=function(){
    jQuery("#input_cliente").autocomplete('/search.php', {
        delay:10,
        minChars:1,
        matchSubset:1,
        matchContains:1,
        cacheLength:10,
        onItemSelect:selectItem,
        onFindValue:findValue,
        formatItem:formatItem
    });

}

seria isso?

 

xiii..perdeu toda a lógica =(

pq aí não dispara o autocomplete.. tem q ser na "load()" mesmo

eu queria saber só um parametro pra passar ali onde estão esses:

 

delay:10,

minChars:1,

matchSubset:1,

matchContains:1,

cacheLength:10,

onItemSelect:selectItem,

onFindValue:findValue,

formatItem:formatItem

 

mas obrigada pela força.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.