This is a migrated thread and some comments may be shown as answers.

AutoFilter False

4 Answers 66 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 19 Apr 2013, 12:59 PM
Hello, I have the autoFilter set to false, but when I hit the enter key the search is not executed.

_searchDS = new kendo.data.DataSource({
        serverFiltering: true,
        transport: {
            read: function (options) {
                var filter = options.filter ? options.filter.filters[0].value : '';
                $.ajax({
                    url: _serviceConst + '/Search?q=' + filter,
                    type: 'GET',
                    success: function (result) {
                        console.log('result came back: ' + result.Object.length);
                        options.success(result);
                    },
                    error: function (xhr, sts, msg) {
 
                    }
                });
            }
        },
        schema: { data: "Object", errors: "Error" }
    });
    if (_searchMV == null) {
        _searchMV = $("#searchresults").kendoMobileListView({
            dataSource: _searchDS,
            template: $("#searchresults-template").text(),
            filterable: true,
            filterable: { autoFilter: false },
            click: function (e) {
            }
        }).data("kendoMobileListView");
    } else {
        _searchMV.setDataSource(_searchDS);
    }
I have also tried the read statement as:
read: {
                url: _serviceConst + '/Search',
                dataType: 'json'
            },
            parameterMap: function (options) {
                var filter = options.filter ? options.filter.filters[0].value : '';
                var parameters = {
                    q: filter
                }
                return parameters;
            }
Both do not execute the search on Enter key.
Thanks.

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 Apr 2013, 08:50 AM
Hello Barry,

I am afraid that the provided information is not sufficient enough in order to determine where the problem comes from. I tested the autoFilter functionality in this sample page, but did not manage to reproduce the problem. Could you please let me know what I am missing?

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Barry
Top achievements
Rank 1
answered on 24 Apr 2013, 11:59 PM
It worked with the second code block using the "parameterMap", but not with the first ajax code block.

1. When I attempt to get access to the input element via jQuery it is not found.
$('input[type=search]').each(function() {
           console.log('Found Search Input');
           $(this).val('Test Value');
    });
2. When I enter a search value in the text box and press the "Search" button on the keyboard in the iPhone simulator, the search executes, but does not hide the keyboard because the focus is still on the search textbox.  How do I blur that control element?  I wanted to use the code block shown above, but it was not working.

Any suggestions?
Thank you.
0
Nikolay Rusev
Telerik team
answered on 26 Apr 2013, 03:35 PM
Hello Barry,

I am not sure what exactly you're trying to achieve, but here is how you can find the search input and hide the keyboard on `Search` button press.
http://jsbin.com/iyufox/4#/

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Barry
Top achievements
Rank 1
answered on 03 May 2013, 12:39 AM
Thank you for your response, unfortunately your example works great on a web browser, but does not work in the iPhone simulator within xcode. I have found the solution for anyone that is interested in hiding the keyboard after they press the "Search" button.

$(document).on("submit", "form", function(event){
           var searchInput = $("input[type=search]");
           searchInput.blur();
    });
Tags
ListView (Mobile)
Asked by
Barry
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Barry
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or