The docs for DataSource.filter() indicate that it returns "the current filter configuration. Returns null if no filter criteria are currently applied. Returns undefined if the DataSource instance has not performed filtering so far." I took this to mean if I set a filter via oldFilter = ds.filter(myFilter), I would get the existing filter config back as "oldFilter", just as if I had called oldFilter = ds.filter() without setting one - its a common pattern for setters. However, the method seems to always return "undefined" in all cases when you set a filter. I've created a dojo example.
Am I misreading the intent, and setting a filter wasn't supposed to return the current filter? If so, the "RETURNS" phrasing in the docs really should be clarified. But in that case this might be a worthwhile feature request, since writing "oldFilter = ds.filter(myFilter)" can be more convenient than doing it in two lines "oldFilter = ds.filter(); ds.filter(myFilter)". It looks like the group() method and perhaps others have the same ambiguity.