How to use Dojo to display tabular data and apply the filter function?
The steps are as follows:
1. Insert the number array into the variable data defined by ItemFileWriteStore,
2. Create an ItemFileWriteStore type data based on the data variable store,
3. Bind the data store to the grid object,
4. Define the click event in the grid, and trigger the filtering function of the grid when clicked.
Specific executable code:
Update 1:
In the above example, the key of the filter and the key of grid.store, and the same name as grid.structure.
After testing, it is found that, in fact, the key in the filter should be the key in grid.store, not the field in grid.structure.
The runnable code of the key of grid.store and the field of grid.structure has been modified:
The modified effect is as follows:
The ccc data does not appear, but the filter effect And existence. It can be seen that grid.filter() actually filters based on the key in grid.store, regardless of whether the key is displayed. The grid.structure part determines whether this key is displayed.
Before screening:
-------------------------- -----------------------------------------------
After screening: