Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is my "open" option for the autocomplete, with autosize (autowidth):</p> <pre><code> open: function(e,ui) { var autoData = $(this).data('autocomplete'); var reserText = ",de,del,el,la,las,los,en,"; autoData.menu.element.css({'width':'' + anchoMinimo + 'px'}); autoData.menu.element.find('li').each(function() { var fila = $(this); var texto = fila.text().toLowerCase().replace(autoData.term.toLowerCase(), "&lt;b&gt;" + autoData.term.toLowerCase() + "&lt;/b&gt;"); var autoText = ""; texto = texto.split(" "); for( i = 0; i &lt; texto.length; i++){ if((reserText.indexOf( texto[i].replace("&lt;b&gt;","").replace("&lt;/b&gt;","") ) != "-1") &amp;&amp; (i &gt; 0)){ autoText += texto[i] + " "; }else if( texto[i].substring(0,3) == "&lt;b&gt;" ){ autoText += "&lt;b&gt;" + texto[i].charAt(3).toUpperCase() + texto[i].substring(4) + " "; }else{ autoText += texto[i].charAt(0).toUpperCase() + texto[i].substring(1) + " "; } } autoText = autoText.replace(" De "," de ").replace(" Del "," del ").replace(" Los "," los ").replace(" El "," el ").replace(" En "," en ").replace(" La "," la ").replace(" Las "," las "); fila.find('a').text(""); fila.find('a').append( autoText ); // Ahora vamos a calcular el ancho de la cadena más ancha para saber qué ancho tiene que tener el combo. ancho = autoText.length * 5; // Con esta fuente de letra, en IE, etc... if(ancho &gt; anchoFilaDestinos){ anchoFilaDestinos = ancho; } // Fin del cálculo del ancho. fila.find('a').css({'white-space':'nowrap','width':'276px','text-align':'left'}); if( fila.index()%2 &gt; 0 ){ fila.find('a').css({'background-color':'#EFEFEF'}); } } </code></pre> <p>See the part from "// Ahora vamos a calcular el ancho de la cadena más ancha para saber qué ancho tiene que tener el combo."</p> <p>Hope this helps you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload