Question: In example # 5, Detached Filters, when you have filter controls that are outside the grid, you have to seperately manage the filter criteria entered in such controls. Why is this needed when I’m using controls outside the grid for filtering, but not when I use column header filtering?
Answer: The DataGrid internally contains a FilterRow object, which is a Flexicious Filter and DataBinding container. For details on this, review http://blog.flexicious.com/post/Custom-Filter-Control.aspx. Basically the idea is that all the Flexicious controls register themselves with the first Flexicious container in their hierarchy. These containers can then call methods on the controls. For the filtering mechanism, this means they can call the getFilterValue and setFilterValue methods on each of the Flexicious controls that have registered with them. Since the control is placed outside the grid, it does not register itself with the Grid's filter row, rather it registers itself with its own container. The grid itself is oblivious to the controls and containers that are outside of its own hierarchy. This is why you have to explicitly let the filtering mechanism of the grid know, that in addition to the filters within the grid, there are filters outside, that will affect the resulting filter to create a combination filter. We demonstrate how to do this in Example 5, Flexicious UI.
One of the driving factors behind this implementation is the loose coupling of the Grid UI and the Filter Control UI. All of the communication is handled via events. The Filter Controls fire a change event, the FilterContainer listens for it, aggregates all filter control values in its hierarchy, fires a change event, the grid listens for it, fires a filterPageSortChangeEvent, which in this case we listen into and append additional filter criteria, and process the resultant filter. A setup like this gives you more control over the UX, for example, you can have multiple Flexicious grids visible, and have additonal detached filters for each of them, or even share the same set of detached filters for multiple grids