listQuery
Uniquely identify the set of data a list contains.
connection.listQuery(list)
Returns the value of the property referenced by listQueryProp if it exists.
By default, this will return list[Symbol.for("can.listQuery")]
.
Parameters
- list
{List}
:A list instance.
Use
Many behaviors, such as the constructor/store, need to have a unique identifier for a list.
This connection.listQuery
method should return that.
Typically, a list's set identifier is a property on the list object. As example, a list of Todos might look like the following:
var dueTodos = todoConnection.getList({filter: {due: "today"}});
dueTodos; // [{_id: 5, name: "do dishes", due:"today"}, {_id: 6, name: "walk dog", due:"today"}, ...]
dueTodos[Symbol.for("can.listQuery")]; //-> {filter: {due: "today"}}
todoConnection.listQuery(dueTodos); //-> {filter: {due: "today"}}
In the above example the listQueryProp would be the default @can.listQuery
.