How to: Filter Data (Runtime Sample)
This document describes how to filter Snap list data in code. To learn how to accomplish this task by using the Snap graphical user interface, see the Filter Document Data topic.
The following method filters a Snap list, by adding a string that contains a filter expression to the SnapList.Filters collection.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-generate-a-document-layout-in-code-via-the-snap-application-programming-interface-api-e4781
using DevExpress.Snap.Core.API;
// ...
private void FilterList(SnapList list) {
const string filter = "[Discontinued] = False";
if (!list.Filters.Contains(filter)) {
list.Filters.Add(filter);
}
}
See Also