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:
export interface LookupSource
Remarks
Used in setLookups, addLookupSource.
Example
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 | string | proper name (id) |
keys | string[] | string[][] | keys |
levels | number | Level in lookup tree |
ordered | boolean | |
values | string[] | value |
Properties Desc
id
Distinguished name (id)
Type
- string
keys
keys
Type
- string[] | string[][]
Remarks:
If level
is greater than 1, key values corresponding to the level must be entered sequentially.
Example:
// 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']]
levels
Level in the lookup tree
Type
- number
Remarks:
It must be 1
or more.
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
values
value
Type
- string[]