We visualize the data in order to do some manipulation of the data.
Here 's a look at the sorting and searching features of DataView.
Mastering these two skills allows the data in the written data interface to be sorted according to the requirements, to be able to perform the search display function of the data.
First, sort
When we want to sort by a field of data, we can call the sort method:
Store.sort (' LastName ', ' ASC ');
Of Store is our well-defined data warehouse, called Sort method to sort. the sort method passes in two parameters. The first parameter is sorted by which field, the second is ascending or descending.
Assuming that you want to sort multiple fields, you can run code such as the following:
Store.sorters.add (New Ext.util.Sorter ({property: ' FirstName ', direction: ' ASC '}); Store.sort ();
By using the sorters.add method, you can add multiple sorting criteria, and finally call the sort () method, and the order in which the sequencing is run is determined by the order of accession.
We can define an option box in the interface, sort by the user's options, by setting the value for each option . The value values are passed into the sort method and sorted according to the requirements.
Second, search
There are methods for filtering data in the Data Warehouse in DataView. The code is as follows:
Store.filter (' LastName ', ' Tom ');
This sentence means that the data is filtered out. The value of its lastName property is Tom.
Similarly. Suppose we want to implement the user's search function. Define a search box to pass the value entered by the user into the filter function. It is also possible to filter by multiple filters (data that is set up for multiple filter times will be selected). Note that you must run the search cleanup operation before each run of the search operation:
Store.clearfilter ();
This ensures that there is no previous search disturbance for each search.
If it's not clear. The content displayed is the intersection of multiple search results (very likely no results).
HTML5 developing mobile Web Apps--sencha Touch (10)