We provide an individual npm package to be used with client-side frameworks that do not depend on jQuery, for example, with Angular. Run the following command to install it:
npm install devextreme-aspnet-data-nojquery
The API consists of a single method, createStore
, which is described here. The following example shows how to use this method in an Angular app to create a store for the DataGrid widget. Note that the widget requires the devextreme-angular package in addition.
app.component.ts
import { Component } from '@angular/core';
import { createStore } from 'devextreme-aspnet-data-nojquery';
import CustomStore from 'devextreme/data/custom_store';
@Component({
selector: 'app-root',
templateUrl: `
<dx-data-grid
[dataSource]="store">
</dx-data-grid>
`
})
export class AppComponent {
store: CustomStore;
constructor() {
let serviceUrl = "http://url/to/my/service";
this.store = createStore({
key: "ID",
loadUrl: serviceUrl + "/GetAction",
insertUrl: serviceUrl + "/InsertAction",
updateUrl: serviceUrl + "/UpdateAction",
deleteUrl: serviceUrl + "/DeleteAction"
});
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { DxDataGridModule } from 'devextreme-angular';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
DxDataGridModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }