Как реализовать фильтр текста из списка при смене символа в текстовом поле - PullRequest
0 голосов
/ 03 декабря 2011

Как реализовать поиск Bing, как в wp7, у меня есть список данных в списке, введя символ в текстовое поле, я должен иметь возможность отфильтровать данные из списка.

Ответы [ 3 ]

0 голосов
/ 29 ноября 2012

В дополнение к использованию AutoCompleteBox, как уже упоминалось, вы должны использовать CollectionViewSource http://www.windowsphonegeek.com/news/wp7-Collectionviewsource-filtering

0 голосов
/ 09 ноября 2017

//JQuery: 
 //mobile - netbanking search
 $(document).on('keyup', '#filter', function (e) {
	// Retrieve the input field text and reset the count to zero
	var filter = $(this).val();

	//Regex created to find value in list.
	var pattern = new RegExp(filter, "i");


	// Loop through the comment list
	$(".list").each(function () {
		// If the list item does not contain the text phrase fade it out

		//Trim space from variable value.
		var str = $(this).text().trim();

		if (str.search(pattern) < 0) {
			$(this).fadeOut();
			//Show the list item if the phrase matches and increase the count by 1
		} else {
			$(this).show();
		}
	});
}); 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
JQuery Solution: 
HTML will be: 

<div class="yourlist">

	<input name="" id="filter" type="text" placeholder="Search list" onkeyup="this.setAttribute('value', this.value);" value="">

		<div class="list" style="display: block;">
			Abc
		</div>
		<div class="list" style="display: block;">
			xyz
		</div>
		<div class="list" style="display: block;">
			qwe
		</div>
</div>
0 голосов
/ 04 декабря 2011

Проверка управления автозаполнением из Silverlight Toolkit для Windows Phone (он находится на codeplex)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...