The feature of the Grid allow us to use custom editor for a column. When using custom editor, it is our responsibility to tell the Grid, how to read and write in the custom editor using the read and write functions of the edit template respectively.
When using edit template for a foreign key column, the foreign key mapping should be handled externally and the appropriate value should be returned from the read function.
Let us discuss how to use an ejAutocomplete to edit a foreign key column.
The create, read and write functions of the edit template are as follows.
In the above code example, the ejAutocomplete is configured to display CompanyName and return the CustomerID in the read function.
The following is displayed as the output of the above behavior.
Figure: Foreign key column with autocomplete editor
The read function will different slightly when using batch edit mode in foreign key column. In this case, the read function should return an object with keys text and value, which should contains the text to be displayed in the cell and value to be saved in the grid data source respectively.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|