LookupEditorBaseAttribute class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
Base class for lookup based editor types.
[AttributeUsage(AttributeTargets.All)]
public abstract class LookupEditorBaseAttribute : CustomEditorAttribute
| parameter | description |
|---|---|
| editorType | Type of the editor. |
Public Members
| name | description |
|---|---|
| AllowClear { get; set; } | Whether the selection can be cleared. When it is not set, the editor allows it when it has a placeholder, e.g. an empty item text, and not otherwise. It is a plain boolean, as a nullable one is not a valid argument of an attribute, and an option that is not set is told apart by not being in the options. |
| Async { get; set; } | Loads the lookup in async mode, default false. |
| AutoComplete { get; set; } | Allows dynamically creating new options from text input by the user in the search box. This option should only be used for free text inputs, not ID / Text pairs. When this option is enabled, InplaceAdd cannot be used. A newly created option will have the same ID / Text as the user-entered text. |
| CascadeField { get; set; } | Cascade filtering field (items will be filtered on this key, e.g. CountryID). Make sure you have the [LookupInclude] attribute on this field of the lookup row, otherwise you'll have empty results as this field won't be available on the client side. |
| CascadeFrom { get; set; } | ID (can be relative) of the editor that this editor will cascade from, e.g. Country. |
| CascadeValue { get; set; } | Cascade filtering value, usually set by the CascadeFrom editor, e.g. the integer value of CountryID. If null or empty, and CascadeField is set, all items are filtered. |
| CheckList { get; set; } | Shows a multiple editor as a checklist, instead of a combobox with a choice for each selected item: the results have check boxes, of which the ones that are selected stay in the list, the first item selects all the results that are shown, or clears them, and the selection is shown as one summary, e.g. "A, B, C +2". It has no effect on a single editor. |
| CssClassField { get; set; } | The field of an item that holds its CSS class, e.g. "text-danger", which the editor adds to the item in its results. |
| Delimited { get; set; } | Use comma separated string instead of an array to serialize values. |
| DialogType { get; set; } | This property is meaningful when InplaceAdd is true. By default, the dialog type name is determined by LookupKey, e.g. if the lookup key is "Northwind.CustomerCity", a dialog class named "Northwind.CustomerCityDialog" is used. If the dialog type is different than the lookup key, set this to the class name, e.g. "MyModule.MyDialog". |
| FilterField { get; set; } | Optional filtering field (items will be filtered on this key, e.g. GroupID). Make sure you have the [LookupInclude] attribute on this field of the lookup row, otherwise you'll have empty results as this field won't be available on the client side. |
| FilterValue { get; set; } | Optional filtering value, e.g. the integer value of GroupID. If null or empty string no filtering occurs. |
| InplaceAdd { get; set; } | Enables inplace add / edit functionality. |
| InplaceAddPermission { get; set; } | Permission required to use inplace add / edit. |
| LookupKey { get; set; } | Lookup key, e.g. Northwind.CustomerCity. |
| MaxSummaryItems { get; set; } | How many of the selected items the summary of a checklist, see CheckList, names before it counts the rest, e.g. 3 for "A, B, C +2". SummaryCountOnly names none of them, and shows how many are selected, e.g. "4 selected", and SummaryNamesAll names them all, and shows how many are selected at the end, e.g. "A, B, C, D (4)", of which the styles cut what does not fit. When it is not set, the editor uses ComboboxEditor.defaults.maxSummaryItems, which is SummaryNamesAll unless the application changes it. The other negative values are reserved for summaries to come. |
| MinimumResultsForSearch { get; set; } | The minimum number of results that must be initially (after opening the dropdown for the first time) populated in order to keep the search field. This is useful for cases where local data is used with just a few results, in which case the search box is not very useful and wastes screen space. AlwaysShowSearch shows it for any number of results, which is what the editor does when it is not set, unless ComboboxEditor.defaults.minimumResultsForSearch says otherwise, and NeverShowSearch, or any other negative value, hides it permanently. |
| Multiple { get; set; } | Allow multiple selection. Make sure your field is a List. You may also set CommaSeparated to use a string field. |
| OpenDialogAsPanel { get; set; } | Opens dialogs as a panel (default value is null, which uses the panel attribute on the dialog class). |
| PlaceholderIcon { get; set; } | The icon of the placeholder, e.g. the icon of the field or of the filter, which the editor shows when nothing is selected. |
| SelectAll { get; set; } | Whether a checklist, see CheckList, has an item that selects all the results that are shown, or clears them when they are all selected. Default is true. Its text tells which: "Select all", "Select all matching" when something is typed, or "Select shown" when there are more results than the ones loaded, e.g. of an asynchronous lookup, whose results come in pages. |
| TextKeyField { get; set; } | The field of an item that holds its local text key, which the editor localizes, or "text" when the text of an item is its key. When it is not set, the text of an item is shown as it is, as it is data for a lookup. |
| const AlwaysShowSearch | The value of MinimumResultsForSearch that shows the search field for any number of results. |
| const NeverShowSearch | The value of MinimumResultsForSearch that hides the search field permanently, as any negative value does. |
| const SummaryCountOnly | The value of MaxSummaryItems that names none of the selected items in the summary of a checklist, and shows only how many are selected, e.g. "4 selected". |
| const SummaryNamesAll | The value of MaxSummaryItems that names all the selected items in the summary of a checklist, and shows how many are selected after them, e.g. "A, B, C, D (4)", which is also the default of the client. |
Protected Members
| name | description |
|---|---|
| LookupEditorBaseAttribute(…) | Base class for lookup based editor types. |
Remarks
Initializes a new instance of the LookupEditorBaseAttribute class.
See Also
- class CustomEditorAttribute
- Source: LookupEditorBaseAttribute.cs