i have a an observable array in my model that is bind to just a list of div’s in the view, i want to create a textbox above that list which will filter out the users, like if i write: “admin” will only show users with name admin in them.
how do i do that in knockout? where should i keep the original list of users?
and how should i filter the observable array ?
my model looks like this:
the observable array is usersWithGroups
var groupsViewModelClass = function () {
var self = this;
ko.mapping.fromJS({
assignedPermissions: [],
avilablePermissions: [],
usersWithGroups: [],
allGroups: []
}, {}, self);
}
thanks
You can use
ko.utils.arrayFilterfunctionExample:
See also: http://www.knockmeout.net/2011/04/utility-functions-in-knockoutjs.html