This section describes the methods that control the ODataContext.
Invokes an OData operation that returns a value.
Parameters:The operation's name.
The operation's parameters.
jQueryvar context = new DevExpress.data.ODataContext({ // ODataContext is configured here }); var products = context.get("GetProductsByRating", { rating: 3 });Angular
import ODataContext from "devextreme/data/odata/context"; // ... export class AppComponent { context: ODataContext; constructor() { this.context = new ODataContext({ // ODataContext is configured here }); let products = this.context.get("GetProductsByRating", { rating: 3 }); } }Vue
<script> import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ // ODataContext is configured here }); export default { mounted() { this.products = context.get('GetProductsByRating', { rating: 3 }); }, // ... } </script>React
// ... import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ // ODataContext is configured here }); class App extends React.Component { constructor(props) { super(props); this.products = context.get('GetProductsByRating', { rating: 3 }); } } export default App;See Also
Invokes an OData operation that returns nothing.
Parameters:The operation's name
The operation's parameters.
The HTTP method for this operation ("GET", "POST", "PATCH", or "MERGE").
"POST" by default.
var context = new DevExpress.data.ODataContext({ // ODataContext is configured here }); context.invoke("Add", { fieldName: "fieldValue" }, "POST");Angular
import ODataContext from "devextreme/data/odata/context"; // ... export class AppComponent { context: ODataContext; constructor() { this.context = new ODataContext({ // ODataContext is configured here }); this.context.invoke("Add", { fieldName: "fieldValue" }, "POST"); } }Vue
<script> import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ // ODataContext is configured here }); export default { mounted() { context.invoke('Add', { fieldName: 'fieldValue' }, 'POST'); }, // ... } </script>React
// ... import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ // ODataContext is configured here }); class App extends React.Component { constructor(props) { super(props); context.invoke('Add', { fieldName: 'fieldValue' }, 'POST'); } } export default App;See Also
Gets a link to an entity with a specific key.
Parameters:The alias of the entity's collection.
The entity's key value.
An object that contains the link to the entity.
Call this method within the insert() or the update() method to change the relationships between entities. The following code links the order with ID 1
to the customer with ID 2
:
var context = new DevExpress.data.ODataContext({ url: "https://js.devexpress.com/Demos/DevAV/odata/", entities: { Orders: { key: "Order_ID", keyType: "Int32" }, Customers: { key: "Customer_ID", keyType: "Int32" } } }); context.Orders.update(1, { Customer: context.objectLink("Customers", 2) });Angular
import ODataContext from "devextreme/data/odata/context"; // ... export class AppComponent { context: ODataContext; constructor() { this.context = new ODataContext({ url: "https://js.devexpress.com/Demos/DevAV/odata/", entities: { Orders: { key: "Order_ID", keyType: "Int32" }, Customers: { key: "Customer_ID", keyType: "Int32" } } }); this.context.Orders.update(1, { Customer: context.objectLink("Customers", 2) }); } }Vue
<script> import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ url: 'https://js.devexpress.com/Demos/DevAV/odata/', entities: { Orders: { key: 'Order_ID', keyType: 'Int32' }, Customers: { key: 'Customer_ID', keyType: 'Int32' } } }); export default { mounted() { context.Orders.update(1, { Customer: context.objectLink('Customers', 2) }); }, // ... } </script>React
// ... import ODataContext from 'devextreme/data/odata/context'; const context = new ODataContext({ url: 'https://js.devexpress.com/Demos/DevAV/odata/', entities: { Orders: { key: 'Order_ID', keyType: 'Int32' }, Customers: { key: 'Customer_ID', keyType: 'Int32' } } }); class App extends React.Component { constructor(props) { super(props); context.Orders.update(1, { Customer: context.objectLink('Customers', 2) }); } } export default App;See Also Feel free to share topic-related thoughts here.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4