Package com.smartgwt.client.docs

# Interface CriteriaEditing

public interface CriteriaEditing

### Criteria Editing

DynamicForms may be used to edit `Criteria` or `AdvancedCriteria` for filtering data from a DataSource.

The main APIs for this are `DynamicForm.getValuesAsCriteria()` and `DynamicForm.setValuesAsCriteria()`.

`getValuesAsCriteria()` will return an AdvancedCriteria object in the following cases:

- The form was previously passed AdvancedCriteria via `setValuesAsCriteria()`
- The form has a specified `DynamicForm.operator` of `"or"`
- `FormItem.hasAdvancedCriteria()` returns true for some item(s) within the form

Note that at the form item level, individual items can support editing of advanced criteria by registering `FormItemCanEditCriterionPredicate`, `FormItemCriterionSetter`, and `FormItemCriterionGetter` objects to implement the methods `canEditCriterion()`, `setCriterion()`, and `getCriterion()`, respectively.

There is also built-in support for `expression-parsing` in DynamicForms. This allows expressions, like '>5' (greater than 5) or 'a...c' (between a and c) to be edited and generated automatically by appropriate formItems.

Some FormItems have special behavior - for instance, a `SelectItem` with `multiple:true` will successfully edit and return criteria with an `inSet` operator.

The common pattern of using nested dynamicForms to edit arbitrary advanced criteria has been implemented via overrides to these methods in the `CanvasItem` class. See `CanvasItem.setCriterionGetter()` for details.

For completely user-driven advanced criteria editing see also the `FilterBuilder` class.

See Also:
  - `DynamicForm.getValuesAsCriteria()`
  - `DynamicForm.setValuesAsCriteria(com.smartgwt.client.data.Criterion)`
  - `DynamicForm.getValuesAsAdvancedCriteria()`
  - `FormItem.hasAdvancedCriteria()`
  - `FormItem.canEditCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.getCriterion()`
  - `FormItem.setCriterion(com.smartgwt.client.data.Criterion)`
  - `CanvasItem.hasAdvancedCriteria()`
  - `FormItem.canEditCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.getCriterion()`
  - `FormItem.setCriterion(com.smartgwt.client.data.Criterion)`
  - `ComboBoxItem.hasAdvancedCriteria()`
  - `FormItem.getCriterion()`
  - `FormItem.canEditCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.setCriterion(com.smartgwt.client.data.Criterion)`
  - `ValuesManager.getValuesAsCriteria()`
  - `ValuesManager.getValuesAsAdvancedCriteria()`
  - `DateRangeItem.hasAdvancedCriteria()`
  - `FormItem.getCriterion()`
  - `FormItem.canEditCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.setCriterion(com.smartgwt.client.data.Criterion)`
  - `MiniDateRangeItem.hasAdvancedCriteria()`
  - `FormItem.getCriterion()`
  - `FormItem.setCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.canEditCriterion(com.smartgwt.client.data.Criterion)`
  - `FormItem.getOperator()`
  - `FormItem.getUseAdvancedCriteria()`
  - `ListGrid.getUseAdvancedCriteria()`