SMART datagrid v.1 > Concepts

Back  Forward

Concepts.Data Lookup Overview

Basically, data cell displays the value of Data Field which is connected to cell column among the values of Data Row being referred by the cell. However, sometimes you may need to display a more meaningful and descriptive value rather than actual value. You can specify lookupDisplay property of the column as true and set several related properties to display another value related to the actual value or another field value in data cell. 


1. lookupValues, lookupLabels

If one or more values are set in lookupValues of Data Column and the values as much as the number of lookupValues are set in lookupLabels, and if the value of data cell is contained in lookupValues list, it will display the value of lookupLabels of the corresponding location. 

If the corresponding value is not in lookupValues or item number of lookupLabels is less than the corresponding location, it will display the original value of data cell. 


2. labelField

You can set DataColumn.labelField to display another field value set by labelField rather than the original value of data cell. If labelField specifies a wrong field, it will be ignored. 

Since labelField gets the value in DataSet level, it can connect several grids to one data set, and if lookup requirement of each grid is different, it may need several labelFields. And, labelField can be the field added for lookup requirement rather than being contained in the data loaded from the server. 

If data row is updated or added, you may need to properly change the value of label field. If synchronization is needed immediately during editing, you can use GridBase.onEditCellUpdated event, and if synchronization will be done after committing row editing, you can change the value of label field within GridDataSet.onRowUpdated and GridDataSet.onRowInserted events. 


2. lookupSource

Lookup Source is an object which creates and manages lookup values in data cell in its own place rather than the data set. Lookup Source class is an abstract class which has defined the methods to be implemented by lookup source, and lookup source which has been implemented is LookupTree. Lookup Source class returns lookup value of one or more key values through LookupSource.lookup method. And, you can also add or reset lookup values in an appropriate time by calling fill or add method. 

Please refer to LookupTree help topic and LookupData example about more details. 


Note
See Also
DataColumn.lookupDisplay
DataColumn.lookupValues
DataColumn.lookupLabels
DataColumn.labelField
DataColumn.lookupSource
LookupSource
DropDownCellEditor
Examples
Data Lookup