Kendo UI Designer Overview : Data providers and data sources : Adding and editing a data source
  

Adding and editing a data source

When you click Add Data Source in the edit data provider page (see Adding and editing a data provider), the Add Data Source dialog box appears (not shown, but similar to the Edit Data Source dialog box shown below). In this dialog box, unlike when auto-creating data sources, you can select a resource table from the Data Object Service and define your own name for the new data source that is different from the name of the resource table that it represents. You can also set other options similar the Edit Data Source dialog box, with some differences as shown and explained, below.
After a data source is created, you can review and modify its definition by clicking the Edit control associated with the data source on the edit data provider page. This displays the Edit Data Source dialog box, as shown for the auto-created CustSalesJFP.ttCust data source in this example:
Figure 10. Edit Data Source dialog box
KUIB_Edit_Data_Source_HTML.png
In the search box, the Edit Data Source dialog box highlights the resource table for which the data source is already created; in the Add Data Source dialog box, this same search box allows you to search through the available Data Object resource tables to select one for which to create the new data source. However, unlike in the Add Data Source dialog box, you cannot change the value specified for Name that has already been created for a data source in the Edit Data Source dialog box.
The Excluded Fields and Included Fields lists allow you to exclude or include all fields, and to drag-and-drop individual fields for exclusion from, or for inclusion in, the fields that are initially available to populate views from this data source. You can also rearrange the field order by dragging and dropping fields within a list. The order of fields in Included Fields is then the default order for the fields shown in views that you create with this data source.
Note: Similar field list settings can also be changed for the individual UI components of a view (see Modules and views).
The Properties of the data source include the ability to define a label (using Label) for each field that is different from its field name shown in the Included Fields list, as shown for the entered Customer label defined for the selected CustNum field in the example. Using Editor Type, you can also select a UI-independent visualization for each field that is different from the initially displayed default, which for the selected CustNum field is changed from integer-input to plain-text. The options for selecting an Editor Type value depend on the field's semantic type shown in parentheses beside each field name in the list. For more information on editor types and semantic types, see Editor and semantic types.
If Client-side Processing is selected (the default), all filtering, paging, sorting, and grouping of fields in a view is managed by the Kendo UI widgets using data that is already retrieved in the client web app. If this check box is cleared, all filtering, paging, and sorting (but not grouping) is managed by the Data Object resource on the server as it responds to read requests from the client.
When you clear Client-side Processing, one additional field is displayed that requires a value, as shown in this example:
Figure 11. Setting the data source for filtering, paging, and sorting on the server
KUIB_Edit_Data_Source_Client_Processing_HTML.png
In Count Function, you must enter the name of an OpenEdge ABL routine in the corresponding Business Entity on the server that implements the Data Object resource. This routine (typically, an ABL class method) returns the total number of records returned by the resource Read operation when server paging is enabled. The data source must know this value in order to manage the paging of records in the client according to the page size of any grid view that is bound to the data source (see Modules and views). For more information on this routine, see the sections on "Updates to allow access by Kendo UI DataSources and Rollbase external objects" in OpenEdge Development: Web Services.
Also, in this example, note that the selected field in Included Fields is SalesrepIDFK (Lookup). In this case, the semantic type for this SalesrepIDFK field is Lookup, which indicates that the field represents a foreign key into another data source where a unique record can be found ("looked up") by matching this foreign key to a primary key in the other (parent) data source. In addition to the Label and Editor Type properties available for all fields, the Properties of a foreign key field include:
*Fields — Lists the fields of the edited (child) data source (CustSalesJFP.ttCust) that define its foreign key, in this case SalesRep.
*Parent Table — Specifies the name of the parent data source table in which to look up the unique record that matches the foreign key, in this case CustSalesJFP.ttCust.
*Parent Fields — Lists the fields of Parent Table that define its primary key, whose values must match the corresponding fields of a given foreign key in order to look up a unique parent record associated with the child data source, in this case also SalesRep.
Note: In this release, the Fields and Parent Fields properties support only a single field to define any foreign or primary key, which happen to have the same name in this example.
You can also select values for the following foreign key Properties:
*Data Source — An available data source that maps to the specified Parent Table, in this case CustSalesJFP.ttCust, which also happens to have the same name specified for Parent Table in the example. If no more than one compatible data source is available for this mapping, the name of only one data source appears as a possible value.
Note: The name is different in every generated view - it can be primeDS, jsdo resource name, or an auto generated name for Foreign Key data sources. This name can be seen in the private controller.
*Display Field — The field from the specified Data Source, in this case RepName, whose value you want to display from the unique record that is found for a given foreign key. This value is displayed in a form using the Editor Type that you select for the foreign key field. For more information on the editor types available to display a value for a foreign key (Lookup type) field, see Editor and semantic types.
Note: The Kendo UI Builder supports a built-in foreign key look up and display only for a foreign key field that you add to forms associated with a Data-Grid* view that is defined with forms. This built-in look up is not supported for a foreign key field that you might add to the grid associated with a Data-Grid* view, or that you might add for any UI component of a Blank view. For more information, see Modules and views.
When you have completed creating or updating a data source definition, you must click Save to save the changes and close the dialog box, then click Save on the edit data provider page to accept and save the changes to its parent data provider.