Ich verwende JQuery AutoCompleter < /code> zum Suchen. $ array = {der König, der König, der Mann} < /code> < /p>
und mein Suchschlüsselwort "Das" dann bekomme ich derzeit nur die Ausgabe wie {der König, der Mann} < /code>
Ich bekomme nicht den König. Die drei Ergebnisse. < /p>
$(document).ready(function() {
$(function() {
$( "#autocomplete" ).autocomplete({
source: function(request, response) {
$.ajax({ url: "",
data: { term: $("#autocomplete").val()},
dataType: "json",
type: "POST",
success: function(data){
response(data);
}
});
},
minLength: 3,
select: function (a, b) {
$(this).val(b.item.value);
$(".searchform1").submit()
}
});
});
$('#autocomplete').focus();
});
function monkeyPatchAutocomplete() {
// Don't really need to save the old fn,
// but I could chain if I wanted to
var oldFn = $.ui.autocomplete.prototype._renderItem;
$.ui.autocomplete.prototype._renderItem = function( ul, item) {
var re = new RegExp("^" + this.term, "i") ;
var t = item.label.replace(re,"" + this.term + "");
return $( "[*]" )
.data( "item.autocomplete", item )
.append( "" + t + "" )
.appendTo( ul );
};
}
$(document).ready(function() {
monkeyPatchAutocomplete();
$("#input1").autocomplete({
// The source option can be an array of terms. In this case, if
// the typed characters appear in any position in a term, then the
// term is included in the autocomplete list.
// The source option can also be a function that performs the search,
// and calls a response function with the matched entries.
source: function(req, responseFn) {
addMessage("search on: '" + req.term + "'
");
var re = $.ui.autocomplete.escapeRegex(req.term);
var matcher = new RegExp( "^" + re, "i" );
var a = $.grep( wordlist, function(item,index){
//addMessage(" sniffing: '" + item + "'
");
return matcher.test(item);
});
addMessage("Result: " + a.length + " items
");
responseFn( a );
},
select: function(value, data){
if (typeof data == "undefined") {
addMessage('You selected: ' + value + "
");
}else {
addMessage('You selected: ' + data.item.value + "
");
}
}
});
});
---------------
---------------
Ich verwende JQuery AutoCompleter < /code> zum Suchen. $ array = {der König, der König, der Mann} < /code> < /p>
und mein Suchschlüsselwort "Das" dann bekomme ich derzeit nur die Ausgabe wie {der König, der Mann} < /code> Ich bekomme nicht den König. Die drei Ergebnisse. < /p>
Bitte helfen Sie mir, mein [url=viewtopic.php?t=20324]Problem[/url] zu lösen.[code] $(document).ready(function() { $(function() { $( "#autocomplete" ).autocomplete({
minLength: 3, select: function (a, b) { $(this).val(b.item.value); $(".searchform1").submit() } }); }); $('#autocomplete').focus(); });
function monkeyPatchAutocomplete() {
// Don't really need to save the old fn, // but I could chain if I wanted to var oldFn = $.ui.autocomplete.prototype._renderItem;
$.ui.autocomplete.prototype._renderItem = function( ul, item) { var re = new RegExp("^" + this.term, "i") ; var t = item.label.replace(re,"" + this.term + ""); return $( "[*]" ) .data( "item.autocomplete", item ) .append( "" + t + "" ) .appendTo( ul ); }; }
$(document).ready(function() {
monkeyPatchAutocomplete();
$("#input1").autocomplete({ // The source option can be an array of terms. In this case, if // the typed characters appear in any position in a term, then the // term is included in the autocomplete list. // The source option can also be a function that performs the search, // and calls a response function with the matched entries. source: function(req, responseFn) { addMessage("search on: '" + req.term + "' "); var re = $.ui.autocomplete.escapeRegex(req.term); var matcher = new RegExp( "^" + re, "i" ); var a = $.grep( wordlist, function(item,index){ //addMessage(" sniffing: '" + item + "' "); return matcher.test(item); }); addMessage("Result: " + a.length + " items "); responseFn( a ); },
Dieses kleine Skript findet Dateien und Ordner, indem sie rekursiv durch Verzeichnisstrukturen analysiert und die von ihnen gespeicherten Pfade zurückgegeben werden. Dies geschah, um einen Ordner auf...
Dieses kleine Skript findet Dateien und Ordner, indem sie rekursiv durch Verzeichnisstrukturen analysiert und die von ihnen gespeicherten Pfade zurückgegeben werden. Dies geschah, um einen Ordner auf...
Ich möchte, dass Ihre Hilfe ein praktisches Beispiel für diese Arten von Suchfaktoren findet, damit die Unterschiede und ihre Verwendungszwecke gesehen werden. # Búsqueda lineal
def lineal(arr,...
Warum müssen Entwickler nach jedem Fall Break anstelle der Codierungssprache Break setzen, anstatt nach jedem Fall von Switch -Anweisungen automatisch automatisch zu brechen? Was ist die Anwendung...