DevExtreme Angular - Utils API
applyChanges(data, changes, options)
Array<any>
Array<any>
Name | Type | Description |
---|---|---|
immutable |
If |
|
keyExpr | | |
Specifies the key property (or properties) that provide(s) keys to locate data items. Default value: "id" |
Array<any>
base64_encode(input)
Encodes a string or array of bytes in Base64.
jQuery
var base64str = DevExpress.data.base64_encode("test");
Angular
import { base64_encode } from "devextreme/data/utils"; // ... export class AppComponent { constructor () { let base64str = base64_encode("test"); } }
Vue
<script> import { base64_encode } from 'devextreme/data/utils'; export default { mounted() { this.base64str = base64_encode("test"); }, // ... } </script>
React
// ... import { base64_encode } from 'devextreme/data/utils'; class App extends React.Component { constructor(props) { super(props); this.base64str = base64_encode("test"); } // ... } export default App;
compileGetter(expr)
The DataSource and stores use this method internally - you do not need to use it directly. Refer to Getters and Setters for more information.
compileSetter(expr)
The DataSource and stores use this method internally - you do not need to use it directly. Refer to Getters and Setters for more information.
errorHandler
Use the setErrorHandler instead.
odata.keyConverters
Contains built-in OData type converters (for String, Int32, Int64, Boolean, Single, Decimal, and Guid) and allows you to register a custom type converter.
The following code shows how to register a custom type converter:
jQuery
DevExpress.data.utils.odata.keyConverters["MyType"] = function (value) { return value + "MT"; };
Angular
import { keyConverters } from "devextreme/data/odata/utils"; // ... export class AppComponent { constructor () { keyConverters["MyType"] = value => { return value + "MT" } } }
Vue
<script> import { keyConverters } from 'devextreme/data/odata/utils'; export default { mounted() { keyConverters['MyType'] = value => { return value + 'MT'; } }, // ... } </script>
React
// ... import { keyConverters } from 'devextreme/data/odata/utils'; class App extends React.Component { constructor(props) { super(props); keyConverters['MyType'] = value => { return value + 'MT'; } } // ... } export default App;
See Also
query(array)
Creates a Query instance.
Array<any>
jQuery
var query = DevExpress.data.query([10, 20, 50, 40, 30]);
Angular
import Query from "devextreme/data/query"; // ... export class AppComponent { constructor () { let query = Query([10, 20, 50, 40, 30]); }; }
Vue
<script> import Query from 'devextreme/data/query'; export default { mounted() { this.query = Query([10, 20, 50, 40, 30]); }, // ... } </script>
React
// ... import Query from 'devextreme/data/query'; class App extends React.Component { constructor(props) { super(props); this.query = Query([10, 20, 50, 40, 30]); } // ... } export default App;
See Also
query(url, queryOptions)
Creates a Query instance that accesses a remote data service using its URL.
The queryOptions object should contain the adapter function that implements data access logic. The queryOptions object can also contain the errorHandler function for handling errors that may occur during the Query's execution.
jQuery
var query = DevExpress.data.query("http://mydomain.com/MyDataService", queryOptions);
Angular
import Query from "devextreme/data/query"; // ... export class AppComponent { constructor () { let query = Query("http://mydomain.com/MyDataService", queryOptions); }; }
Vue
<script> import Query from 'devextreme/data/query'; export default { mounted() { this.query = Query('http://mydomain.com/MyDataService', queryOptions); }, // ... } </script>
React
// ... import Query from 'devextreme/data/query'; class App extends React.Component { constructor(props) { super(props); this.query = Query('http://mydomain.com/MyDataService', queryOptions); } // ... } export default App;
See Also
setErrorHandler
A method that specifies a function to be executed when a Data Layer component throws an error.
jQuery
DevExpress.data.setErrorHandler(function (error) { console.log(error.message); }); // ===== or when using modules ===== import { setErrorHandler } from "data/errors"; setErrorHandler(function(error) { console.log(error.message); });
Angular
import { setErrorHandler } from "data/errors"; setErrorHandler(function(error) { console.log(error.message); });
Vue
import { setErrorHandler } from "data/errors"; setErrorHandler(function(error) { console.log(error.message); });
React
import { setErrorHandler } from "data/errors"; setErrorHandler(function(error) { console.log(error.message); });
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.