Sample instantiation for an OpenEdge Data Object Service
- Last Updated: July 28, 2025
- 8 minute read
- OpenEdge
- Version 12.2
- Documentation
The following DataSource is instantiated to access an OpenEdge ProDataSet
resource that supports before-imaging and the Submit operation, dsCustomerOrd:
|
Note that this example DataSource accesses a JSDO that is instantiated prior to
instantiating the DataSource itself. This also assumes that a user login session has
been created for the JSDO and a Data Service Catalog describing the dsCustomerOrd resource has already been added to the JSDO
session. For more information on creating a user login session for a JSDO and adding a
Catalog to the session, see progress.data.JSDOSession class.
Following is a brief description of the configuration options specified in the sample definition for the JSDO dialect of the Kendo UI DataSource shown above:
- Setting the standard
typeproperty to"jsdo"— Specifies that the Kendo UI DataSource is being instantiated for the JSDO dialect. - Setting the standard
serverPaging,serverFiltering, orserverSortingproperties totrue— Ifserver*properties aretrue, the specified processing (paging, filtering, sorting) is performed on the server, and ifserver*properties arefalse, the specified processing is done locally by the Kendo UI DataSource.For example, if the
serverFilteringproperty istrue, the settings for its relatedfilterproperty on the DataSource (or from any more recent invocation of thefilter( )method on the DataSource) are passed to the resource's Read operation on the server to filter the data before it is returned to the client. IfserverFilteringisfalse, the latest DataSourcefiltersettings are used to filter the data that already populates the DataSource. The same is true of the remainingserver*configuration properties and their related property settings, such as the settings of theserverPagingproperty and its relatedpageSizeproperty, and the settings of theserverSortingproperty and its relatedsortproperty.Note: When anyserver*properties aretrue, the format of the related property values that the DataSource passes to the resource's Read operation depends on the Data Object Service type. For more information, see the description of the JSDO fill( ) method.If all of these
server*properties arefalse, the JSDO receives the records for the single (or specified) table of its resource, in whatever quantity and order they are received from the resource's most recent Read operation on the server, and passes them to the DataSource which then manages all paging, filtering, and sorting of the records in its own internal memory.Note: The JSDO dialect of the DataSource does not support setting theserverGroupingorserverAggregatesconfiguration properties totrue. You should either leave these properties not set, or set them tofalse. That is, any data grouping and aggregate features of Kendo UI can only be managed by the Kendo UI DataSource itself. If you set any of these properties totrue, the respective feature is ignored by both the server and the JSDO dialect of the Kendo UI DataSource. - Set the JSDO dialect
jsdotransport property — Thejsdoproperty specifies the JSDO that is accessed by the DataSource. In the sample, an existing instance of the JSDO (myjsdo) is specified. You can also specify the name of a JSDO resource as a string, and the DataSource will create the JSDO instance for you. This is the same resource name you would use to create the JSDO yourself. In this sample, you would specify thejsdovalue as"dsCustomerOrd". - Set the JSDO dialect
tableReftransport property — Required only for a JSDO created for a resource that is a multi-table ProDataSet, thetableRefproperty specifies the name of the JSDO table whose data the DataSource handles. So, for an OpenEdge ProDataSet, you specify the name of the corresponding temp-table in the Business Entity (ttCustomerin the sample). If you want to access the data in all tables in the ProDataSet, you need to create a separate Kendo UI DataSource for each table accessed by the JSDO and attach it to a Kendo UI widget appropriately. - Set the JSDO dialect
countFnNametransport property — ThecountFnNameproperty specifies the name of the Invoke operation method in the Business Entity that returns the total number of records in the server result set to the Kendo UI DataSource when using server paging (serverPaging == true). For more information on implementing this method, see the sections on updating Business Entities for remot http client access in OpenEdge Development: Web Services. Note that for a JSDO that reads data from a multi-table ProDataSet, this Invoke operation method only returns the total number of records in the result set (in all pages) of the parent table.Note: You can annotate a Count operation method in a Business Entity that you implement to return the total number of records. With this annotation, you do not need to specify thecountFnNametransport property for the corresponding Kendo UI DataSource. For more information, see the documentation on coding Business Entities for access by Kendo UI DataSources. - Set the JSDO dialect
autoSaveandreadLocaltransport properties — These settings are most useful if thetableRefproperty specifies the name of a child table that is related to a parent table residing in the same JSDO instance specified by thejsdoproperty. For more information, see the description of these properties in Features of the JSDO dialect. - Set the standard
batchproperty — Specifies how record changes are processed when thesync( )method is called on the DataSource, depending on thebatchproperty setting (falseby default). Ifbatch == true, the JSDO resource must define a Data Object Service Submit operation. The following table shows how the DataSource responds to the setting of itsbatchproperty, depending on whether a Submit operation is defined in the JSDO:Table 2. JSDO dialect response to the batch property setting on the DataSource DataSource batchproperty settingDoes JSDO define a Submit operation? DataSource response when saving changes falseNo The transport gets a change for a single record. This record change is sent to the server one record at a time, using the corresponding Data Object Service Create, Update, or Delete operation (by calling saveChanges(false)on the JSDO).trueNo The DataSource throws an exception if saving changes to the server with batch == truewhen the JSDO does not define a Submit operation.falseYes The transport gets a change for a single record. This record change is sent to the server one record at a time, using the Data Object Service Submit operation (by calling saveChanges(true)on the JSDO).trueYes The transport gets changes for one or more records in an array. All the changes are grouped by the JSDO and sent to the server using the Data Object Service Submit operation (by calling saveChanges(true)on the JSDO).Note: For a standard Kendo UI DataSource withbatch == true, multiple record changes are grouped together so that all record changes of a given type (create, update, or destroy) are sent to the server at one time by the DataSource transport. However, the transport for the JSDO dialect can only send the entire set of record changes (all create, update, and destroy changes together) in a single Data Object Service Submit operation. - Handle the parameter (
e) and associated JSDO errors returned by the DataSourceerrorevent handler function — Theerrorevent handler function is called when an error occurs while performing CRUD or Submit operations on a remote data service (the JSDO in this case). An error can thus be returned when invoking theread( )method or thesync( )method on the DataSource, which in this case invokes a Submit operation on any changed data in the JSDO.As shown in Table 1, the
errorThrownproperty of the event parameter (e) is set, along with some additional properties, depending on the types of errors returned. To process these errors for a JSDO, you can look at the following:e.errorThrown.message- The result of calling
getErrors( )on the JSDO table reference that the DataSource is accessing
If an error occurs after invoking the DataSource
sync( )method when saving changes in the JSDO to the server, the following generic message is typically returned ine.errorThrown.message:"JSDO: Error while saving changes.". This message is returned if one or more errors occurs while saving JSDO changes, regardless of thebatchproperty setting on the DataSource. So for example, ifbatch == true, and multiple errors occur for a single Data Object Service Submit operation, this one error message is returned for all of them.Additional errors from calls to the JSDO dialect
read( )orsync( )method can be returned in other property settings of theeparameter, such ase.xhr, as well as from the JSDO table itself, depending on the type of error. However, all of these errors can be returned using a single call to the JSDOgetErrors( )method on the JSDO table reference.This JSDO method thus returns different types of errors that result from calling the:
- JSDO dialect
read( )method, which ultimately calls the JSDOfill( )method to invoke a Progress Data Object Read operation. These include errors from executing the Read operation itself. - JSDO dialect
sync( )method, which ultimately calls the JSDOsaveChanges( )method to invoke Progress Data Object CUD or Submit operations. These include errors from executing the operations themselves. They, in turn, can include different types of errors depending on if the Data Object resource supports before-imaging or not.Note: Submit operations must always process data with before-image support. Note also that even when the DataSource invokessync( )for one record change at a time (withbatch == false), if the JSDO defines a Submit operation, the DataSource invokes a separate Submit operation for each record that is changed. - JSDO dialect
read( )orsync( )method regardless of the Data Object operation. These include errors that originate from the network, web server, or web application that hosts the Data Object Service, or otherwise result from the operation being inaccessible.
The error handler in the sample handles all these types of errors. The JSDO
getErrors( )method is invoked on the JSDO table (ttCustomer) that the DataSource references and returns an array of objects, each of which contains properties describing an error depending on the error type. The method call stores this array in a variable (dataErrors), as shown in the following fragment from the previous sample:myjsdo = new progress.data.JSDO({ name: 'dsCustomerOrd' }); var dataSource = new kendo.data.DataSource( { type: "jsdo", . . . transport: { jsdo: myjsdo, tableRef: "ttCustomer", . . . }, batch: true, error: function(e) { var dataErrors, error = "", i, j; console.log('Error: ', e); if (e.errorThrown) { error = "\n" + e.errorThrown.message; } dataErrors = this.transport.jsdo.ttCustomer.getErrors(); for (var i = 0; i < dataErrors.length; i++) { /* each error */ error += "\n" + JSON.stringify(dataErrors[i]); } alert("JSDO error(s) returned: " + error); e.preventDefault(); } } );Note: In the sample,thisrefers to the Kendo UI DataSource, allowing access to its properties, methods, and events.The sample then loops through the
dataErrorsarray to log the contents of each error object as a string using the standardJSON.stringify( )method. The properties that can be returned for eachgetErrors( )error object include:errNum— An error number that appears only in errors from operation routines running on the server.error— A string containing an error message, depending on the error type (typeproperty value).id— The internal ID of any single record object associated with the error. This value can be used to return the record and its current field values by calling thefindById( )method on the JSDO table reference.responseText— A string that can contain additional error information for general network and server errors, regardless of the operation.type— Identifies the type of error, indicated by a numeric constant.
Some errors returned by
getErrors( )are exclusive of other errors, while others can be returned as part of a series of errors, depending on the operations and the data for which the errors are generated. For more information on these error object properties and how they can be returned bygetErrors( ), see the getErrors( ) method description.So, when the sample
errorfunction executes, it:- Logs the entire contents of
eto the console log. - Creates a multi-line error string (
error) starting with the contents ofe.errorThrown.message. - Concatenates one or more error lines to the multi-line
error string from the contents of each error object returned by
getErrors( ). - Displays an alert box showing the contents of the multi-line error string.
string formatted according to
the capabilities of the original OpenEdge data type. However, the JSDO dialect of the
Kendo UI DataSource converts and works with these JSDO date/time values as JavaScript
Date objects, which maintain complete date, time,
and time zone information for every JSDO date/time value, regardless of its original
OpenEdge data type. To enforce a consistent exchange of data/time information between
JavaScript Date objects and OpenEdge date/time data
types, the JSDO therefore automatically follows specific rules when exchanging date/time
values between JavaScript Date objects and string fields that represent a specific OpenEdge data/time
data type. For more information, see OpenEdge ABL to JavaScript data type
mappings.