javascript - Creating a binding list projection from a list of search terms -
i trying create filtered list projection collection of search terms. instance, if have 1 search term, can this:
if (options.groupkey == "filtered") { this._items = data.getitemsfromgroup(this._group); var query = windows.storage.applicationdata.current.localsettings.values["filters"]; this._items = this._items.createfiltered(function (item) { if (item.content.search(query) > -1) { return true } else { return false } }) }
but if 'filters' local setting crlf delimited list, this:
cisco microsoft dell
currently, search compare each term 'cisco/nmicrosoft/ndell' won't work. content.search
doesn't accept array. should loop in createfiltered
function somehow? doesn't seem in spirit of projection. accepted way this?
what storing , object in "filters"
settings every filter property? work you?
if (options.groupkey == "filtered") { this._items = data.getitemsfromgroup(this._group); var query = windows.storage.applicationdata.current.localsettings.values["filters"]; this._items = this._items.createfiltered(function (item) { return object.keys(query).indexof(item) > -1; }) }
the query
object follows:
{ cisco: "", microsoft: "", dell: "" }
does make sense?
edit: made little change in code since believe if (query[item])
return false
because of javascript type-casting
Comments
Post a Comment