filters: combine filters first
This commit is contained in:
parent
036b6d6099
commit
653a329698
|
@ -1,4 +1,4 @@
|
|||
define([], function () {
|
||||
define(["filters/nodefilter"], function (NodeFilter) {
|
||||
return function () {
|
||||
var targets = []
|
||||
var filterObservers = []
|
||||
|
@ -26,9 +26,13 @@ define([], function () {
|
|||
if (data === undefined)
|
||||
return
|
||||
|
||||
filteredData = filters.reduce( function (a, f) {
|
||||
return f.run(a)
|
||||
}, data)
|
||||
var filter = filters.reduce( function (a, f) {
|
||||
return function (d) {
|
||||
return a(d) && f.run(d)
|
||||
}
|
||||
}, function () { return true })
|
||||
|
||||
filteredData = new NodeFilter(filter)(data)
|
||||
|
||||
targets.forEach( function (t) {
|
||||
t.setData(filteredData)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(["filters/nodefilter"], function (nodefilter) {
|
||||
define([], function () {
|
||||
return function (name, key, value, f) {
|
||||
var negate = false
|
||||
var refresh
|
||||
|
@ -44,7 +44,7 @@ define(["filters/nodefilter"], function (nodefilter) {
|
|||
}
|
||||
}
|
||||
|
||||
return { run: nodefilter(run),
|
||||
return { run: run,
|
||||
setRefresh: setRefresh,
|
||||
render: render
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue