A widget that allows a user to select predefined values from a lookup window.

Type: Object

The dxLookup widget allows users to select predefined values from a lookup window. To create the dxLookup widget, add a div element with dxLookup Knockout binding within the body of the required view.

<div data-bind="dxLookup:{dataSource: employees, displayExpr: 'name', valueExpr: 'id'}"></div>

The lookup items are loaded from an array specified via the dataSource configuration option. You can specify a simple array or an array of objects as the widget data source.

var employees = [
    { id:1, name: "Bob", hired: 2005 },
    { id:2, name: "John", hired: 2007 },
    { id:3, name: "Frank", hired: 2001 },
    { id:4, name: "Robert", hired: 2007 },
    { id:5, name: "Paul", hired: 2011 },
    { id:6, name: "Elizabeth", hired: 2000 },
    { id:7, name: "Mary", hired: 2002 },
    { id:8, name: "Michael", hired: 2003 },
    { id:9, name: "George", hired: 2002 },
    { id:10, name: "Deborah", hired: 2000 },
    { id:11, name: "Lisa", hired: 1999 },
    { id:12, name: "Mark", hired: 2011 }

To display lookup items, a default template is applied based on the following fields of the data source item objects.

  • disabled
    Specifies whether the lookup item is disabled.
  • visible
    Specifies whether the lookup item is visible.
  • html
    Specifies the html code inserted into the item element.
  • text
    Specifies the text inserted into the item element.

If there is no text field in the data source objects, set another data source field to the displayExpr configuration option to enable a user to select the required object by the value of this field.

You can introduce a custom template for lookup items. For this purpose, add a div element with the data-options attribute set to dxTemplate. Provide the item name for the template. In this instance, the template will be applied automatically. See the Customize Widget Item Appearance topic to learn more about templates.

The dxLookup widget uses the byKey() method of the Store wrapped by the DataSource instance passed to the dataSource option of the widget. If you use a CustomStore, you should pass the function implementating the byKey() method to the byKey configuration option of the CustomStore.

Refer to the Add a Widget documentation section to learn how to create widgets in detail.

Show Example:


An object defining configuration options for the dxLookup widget.


This section describes methods that can be used to manipulate a widget.


This section describes events fired by this component.