http://blog.pragmaswitch.com/?p=1670からこれを入手しましたが、美しく動作します。すべての検索画面で使用しています。
myapp.BrowseScreen.SearchText_postRender = function (element, contentItem) {
// This block is from somewhere else, sets the focus to the search box
$searchBox = $("input", $(element));
setTimeout(function () {
$searchBox.focus();
}, 1);
// The blog post linked above set the required characters to 3, but I liked the instant filtering of 1
onInputAsYouType(element, 1, function (text) {
contentItem.screen.SearchText = text; //SearchText here is the data item in the screen designer linked to the query parameter
});
function onInputAsYouType(element, numberOfRequiredChars, done) {
var inputbox = $("input", $(element));
inputbox.on("input", function (e) {
var text = $(this).val();
if (text.length >= numberOfRequiredChars)
done(text);
});
};
};
スクリーンショットについてはブログ投稿にアクセスできますが、それは非常に簡単です。ブラウズ/検索画面を作成し、検索テキストをテキスト ボックスにして、このコードをポスト レンダリングにプラグインします。