The start page of my application will have a search box, and a list of useful links below the searchbox (favorites etc)
When someone types text in the searchbox, I want the favorites to disappear, and only the search results to be visible.
I've implemented a proof of concept here using a mobile list view:
$("#local-filterable-listview").kendoMobileListView({
dataSource: dataSource,
template: $("#mobile-listview-filtering-template").text(),
filterable: {
field: "ProductName",
operator: "startswith"
},
virtualViewSize: 100,
endlessScroll: true
});
I'm considering instead of setting the display:hidden
of the contents of the listview, that instead I'll set the datasource to null. This "might" be a better approach.
Question
How can I detect when there is text (other than the placeholder) in the searchbox so that
- The datasource can be set/unset as needed.
- The "favorites" can be invisible/visible as needed
One thing I'm unsure of, is that when the text is typed in the search box, and then I bind the datasource.. what will the result be? Will the results be filtered, or will I need to refilter the results? (there is no public method to filter these results in Kendo UI)
I would try this myself, but I don't know how to detect if the searchbox text changed. I could poll the text property, but that seems like a less-than-ideal solution.