The RadDataForm contains many built-in property editors that are either automatically resolved depending on the property's type or by the associated annotation @DataFormProperty
editor. The RadDataForm currently ships with the following built-in editors:
The RadDataForm 'annotations' can be used to easily assign an editor to a property of the set Entity. The next example demonstrates how to set the editor of a property via the described annotations:
The DataFormRadAutoCompleteEditor is a bit more advanced editor which provides an out of the box quick search functionality. This editor uses the RadAutoCompleteTextView stand alone element and all its functionality like
DisplayMode is available to the RadDataForm editor.
Because of the nature of the RadAutoCompleteTextView the editor which exposes its functionality requires some additional data to be passed to it which will be used as the 'suggestions' when a user starts typing in its text box.
Passing this data can be done in multiple different approaches depending on which one is the easiest for your scenario:
- By using the
additionalDataproperty of the @DataFormProperty and setting it to an static
- By creating an
AutoCompleteAdapterand setting it to the DataFormRadAutoCompleteEditor via its
Or by directly by calling the
updateValues()of the specific
EntityPropertyCoreobject. The next code snippet shows how you can use the mentioned 'updateValues' method on an existing 'from' property of the RadDataForm, the
listobject is a simple
Because calling the updateValues can be done after the editor has been rendered you need to make sure you also update the DataFormRadAutoCompleteEditor itself by simply calling its
If you are familiar with the RadAutoCompleteTextView element you know that is supports out of the box two different selected items display modes:
- Token - the selected item from the 'suggestion box' is displayed as a box with a remove 'X' button
- Plain - the selected item's text is appended and autocompleted after an item from the 'suggestion box' is selected
When using the
DataFormRadAutoCompleteEditor you too have the option to change the editor's
displayMode by simply calling its
setDisplayMode() and passing the desired mode:
When the displayMode is set to
TOKEN if the bound to that editor property of your EntityProperty is of type
String and each of its elements is present in the "suggestion source" those items from the array will be rendered as separate tokens.
The full Java source code of the above example can be found here.