0

autocomplete_extender テキストボックスが必要です。以下のようなコードを書きました。

 //For autocomplete extender 
$(function () {
    $('.tags').autocomplete({
        source: function (request, response) {
            $.ajax({
                url: "GoalSheet2.aspx/GetAllMentoredMembers",
                data: "{ 'prefixText': '" + request.term + "' }",
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    response(data.d);

                    self.LoadGoal();
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert('error occured while autocomplete');
                }
            });
        },
        minlength: 2,
    });
});

しかし、ここでは jquery オートコンプリートを使用しています。ノックアウトでそれを行う方法はありますか?そして、1つの値を選択した後、その値を取得したいと思います。

4

1 に答える 1

1

カスタム バインディングを作成し、バインディングにオートコンプリートを適用できます。

カスタム バインディングの実装方法の詳細については、http://knockoutjs.com/documentation/custom-bindings.htmlを参照してください。

カスタムバインディングを介してjquery datepickerをアタッチする方法を説明した私の記事も読むことができますが、それはロシア語で書かれています. Google で翻訳してみるか、jsfiddle でコードを確認してください。http: //www.delmadman.blogspot.com/2012/01/jquery-datepicker-c-knockoutjs.html

于 2012-11-05T10:15:59.857 に答える