For a project we are working on, we have a ScrollView pointing to a local data source (per customer requirements). This data source needs to be filterable by a few fields, which seems to work properly until we run into a scenario where we need to "clear" our filters. I've recreated our scenario within the Dojo, the link is below. I can demonstrate the two issues we are seeing by performing the following:
- Simply click "Set Filter". Notice that nothing happens, unless you click "Set Filter" again. If you uncomment this line in setFilter, you will see that pushing the button "works" the first time:
// ds.filter({});
- Re-running the example from scratch, you will notice if you click on any of the items, it renames it by fetching it from the data source and then calling ".set()" on that object. Now, if you hit "Set Filter" and then "Reset Filter", try swiping to the 2nd or 3rd page and then clicking on one of the items. The item is updated, but the ScrollView switches itself back to the first page. This only seems to happen *after* filter(filter) has been called on the DataSource the first time and then one of the objects is modified, before filter() is called then it works as expected. I was looking at the filter() function within the compressed Kendo source, and although I don't understand what "t" is you can clearly see "what" is happening, just not "why":
function
filter(e){
var
n=
this
;
return
e===t?n._filter:(n._query({filter:e,page:1}),n.trigger(
"reset"
),t)
}
That was actually the first time I've seen syntax like that in Javascript, where the second half of a shorthand if/else executes a function call wrapped in parentheses. Aside from trying to get around these issues, what is the "correct" way to remove filters from a data source? I didn't see anything in the documentation and there are some pretty varied opinions on the web about how to do this.
Here's a link to the example: http://dojo.telerik.com/egadU/2
We are developing with version 2015.1.429, but I replicated this using 2015.2.624 within the Dojo.