getPeople(filter)
An optional filter query may be provided by which to filter the people collection. Space separates the query terms, for example "john bob" will find all users whose first or second names contain the strings "john" or "bob".
Parameters
- filter
- This is a query string by which to filter the collection of people. If null then all people stored in the repository are returned.
Returns
Returns a collection of people objects as a JavaScript array.
Example
getPeople(filter, maxResults)
An optional filter query may be provided by which to filter the people collection. Space separates the query terms, for example "john bob" will find all users whose first or second names contain the strings "john" or "bob".
Parameters
- filter
- This is a query string by which to filter the collection of people. If null then all people stored in the repository are returned.
- maxResults
- The maximum number of results to return. Returns all results if this value is set to be less than or equal to zero.
Returns
Returns a collection of people objects as a JavaScript array.
Example
The following snippet would return all users whose first or last names contained the string "fred". The results are limited to a maximum of 10 results:
model.users = people.getPeople("fred", 10);
getPeople(filter, maxResults, sortBy, sortAsc)
An optional filter query may be provided by which to filter the people collection. Space separates the query terms, for example "john bob" will find all users whose first or second names contain the strings "john" or "bob". This method supports sorting by specifying sortBy and sortAsc parameters.
Parameters
- filter
- This is a query string by which to filter the collection of people. If null then all people stored in the repository are returned.
- maxResults
- The maximum number of results to return. Returns all results if this value is set to be less than or equal to zero.
- sortBy
- The field for sorting.
- sortAsc
- Set to true to sort results in ascending order.
Returns
Returns a collection of people objects as a JavaScript array.
Example
The following snippet would return all users whose first or last names contained the string "fred", sorted in ascending order on lastName. The results are limited to a maximum of 10 results:
model.users = people.getPeople("fred", 10, "lastName", true);