Angular Lookup - Customize the Drop-Down Menu
On desktops and iOS devices, the drop-down menu is the Popover UI component; on other devices, it is the Popup UI component. To use the Popup on all devices, assign false to the usePopover property.
To customize the Popup or Popover, use the dropDownOptions object. For example, the following code removes shading from beneath the Popup and disables full-screen mode:
- <dx-lookup
- [dataSource]="lookupDataSource"
- [usePopover]="false">
- <dxo-drop-down-options
- [shading]="false"
- [fullScreen]="false">
- </dxo-drop-down-options>
- </dx-lookup>
- import { DxLookupModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
- }
- @NgModule({
- imports: [
- // ...
- DxLookupModule
- ],
- // ...
- })
To change the size of the drop-down menu and position it against a specific element on your page, specify the height, width and position properties in the dropDownOptions object. The following configuration of the position property reads as follows: "place my left side at the left side of the "#targetElement".
- <img id="targetElement" src="http://here/goes/my.jpg">
- <dx-lookup [dataSource]="lookupDataSource">
- <dxo-drop-down-options
- [height]="300"
- [width]="300">
- <dxo-position
- my="left"
- at="left"
- of="#targetElement">
- </dxo-position>
- </dxo-drop-down-options>
- </dx-lookup>
- import { DxLookupModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
- }
- @NgModule({
- imports: [
- // ...
- DxLookupModule
- ],
- // ...
- })
The drop-down menu can have a title. Use the dropDownOptions.title property to specify its text, or the dropDownOptions.titleTemplate property to redesign it completely. For details on implementing templates, see the Customize Item Appearance topic.
- <dx-lookup [dataSource]="lookupDataSource">
- <dxo-drop-down-options
- title="Products">
- <!-- titleTemplate="titleTemplate">
- <div *dxTemplate="let title of 'titleTemplate'">
- <div style='color: blue'>Products</div>
- </div> -->
- </dxo-drop-down-options>
- </dx-lookup>
- import { DxLookupModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
- }
- @NgModule({
- imports: [
- // ...
- DxLookupModule
- ],
- // ...
- })
If you have not specified anything to be displayed in the title, hide it by assigning false to the dropDownOptions.showTitle property.
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.