{/* Do not edit this file. It is automatically generated by API Documenter. */}


## LookupSource

Setting information for displaying a different value associated with a data field in a cell instead of the actual value of the data field linked to the column.

**Signature:**

```typescript
export interface LookupSource
```

## Remarks

Used in [setLookups](/refs/Class/GridBase#setlookups){/* */}, [addLookupSource](/refs/Class/GridBase#addlookupsource).

## Example


```js
dataProvider.setFields([
     { fieldName:"field1"},
     { fieldName:"field2"},
     { fieldName:"text1"},
     { fieldName:"text2"},
     ....
]);
gridView.setColumns([
     { fieldName:"field1", name:"field1", lookupDisplay:true, lookupSourceId:"field1Data", lookupKeyFields:["field1"], editor:{type:"dropDown"}},
     { fieldName:"field2", name:"field2", lookupDisplay:true, lookupSourceId:"field2Data", lookupKeyFields:["field1","field2"], editor:{type:"dropDown"}},
     { fieldName:"text1", name:"text1"},
     { fieldName:"text2", name:"text2"}
     ....
]);
// Configure the column so that the list of dropDown Editor in field2 changes when the cell in field1 is modified
....
gridView.setLookups([
     { id:"field1Data",
       levels:1,
       keys:["data1","data2","data3"],
       values:["Data1","Data2","Data3",],
     },
     { id:"field2Data",
       levels:2,
       keys: [
         ["data1","data1_code1"],
         ["data1","data1_code2"],
         ["data1","data1_code3"],
         ["data1","data1_code4"],
         ["data2","data2_code1"],
         ["data2","data2_code2"],
         ["data3","data3_code3"],
         ["data3","data3_code4"]
       ],
       values:[
         ["Data1_Code1"],
         ["Data1_Code2"],
         ["Data1_Code3"],
         ["Data1_Code4"],
         ["Data2_Code1"],
         ["Data2_Code2"],
         ["Data3_Code1"],
         ["Data3_Code2"]
       ],
      }
]);
// When data1 is selected in field1, only the subcodes of data1 are shown in the dropDown Editor of field2.
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [id](/refs/Interface/LookupSource#id) | string | proper name (id) |
| [keys](/refs/Interface/LookupSource#keys) | string\[\] \| string\[\]\[\] | keys |
| [levels](/refs/Interface/LookupSource#levels) | number | Level in lookup tree |
| [ordered](/refs/Interface/LookupSource#ordered) | boolean | |
| [values](/refs/Interface/LookupSource#values) | string\[\] | value |

## Properties Desc

### id

Distinguished name (id)

`Type` - string

<hr/>

### keys

keys

`Type` - string\[\] \| string\[\]\[\]

**Remarks:**

If `level` is greater than 1, key values corresponding to the level must be entered sequentially.

**Example:**


```js
// If level 1
['Animals', 'Plants', 'Fungi']

// In case of level 2
[['animal', 'human'], ['animal', 'rat'], ['plant', 'petunia'], ['plant', 'Flytrap'], ['fungus', 'blue mold' ], ['fungus', 'pine mushroom']]
```

<hr/>

### levels

Level in the lookup tree

`Type` - number

**Remarks:**

It must be `1` or more.

<hr/>

### ordered
> Warning: This API is now obsolete.
>
> Sortability
>

`Type` - boolean

**Remarks:**

Removed in version 2.8.5 and changed to appear in the order in which they were entered

<hr/>
### values

value

`Type` - string\[\]

<hr/>