Coder Social home page Coder Social logo

abiorga / devextreme.aspnet.data Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devexpress/devextreme.aspnet.data

0.0 1.0 0.0 224 KB

DevExtreme data layer extension for ASP.NET

License: MIT License

PowerShell 0.71% TypeScript 0.14% JavaScript 11.95% HTML 0.18% C# 86.65% Batchfile 0.38%

devextreme.aspnet.data's Introduction

DevExtreme ASP.NET Data

Build status NuGet npm Bower

This extension enables DevExtreme client-side widgets to consume data from the server in ASP.NET applications. A widget communicates with the server in the following manner: the widget sends data loading options (filtering, grouping, sorting, and other options) to the server, the server processes data according to these options and then sends processed data back to the widget. In this way, you delegate all intensive data operations from the client to the server, thus significantly improving the performance of DevExtreme widgets. This extension can be used directly with the widgets as well as with their server-side wrappers.

Installation

Server Side

The server-side part of the extension is the DevExtreme.AspNet.Data.dll assembly. Install it from NuGet with the following command.

Install-Package DevExtreme.AspNet.Data

Client Side

The client-side part is the dx.aspnet.data.js script. You can install it in one of the following ways.

  • Using npm.

    Run the following command in the command line.

      npm install devextreme-aspnet-data
    
  • Using bower.

    Run the following command in the command line...

      bower install devextreme-aspnet-data
    

    ... or add devextreme-aspnet-data to the bower.json file into the dependencies section.

    "dependencies": {
        ...
        "devextreme-aspnet-data": "^1"
    }
    

After installation, link the dx.aspnet.data.js script after the DevExtreme scripts on your page.

<!-- if you have used npm -->
<script src="/node_modules/devextreme-aspnet-data/js/dx.aspnet.data.js"></script>
<!-- if you have used bower -->
<script src="/bower_components/devextreme-aspnet-data/js/dx.aspnet.data.js"></script>

See Also

Custom Model Binder

The server needs a custom model binder that will receive data loading options from the client and bind them to the model. The following links show how to implement it.

NOTE: If you use DevExtreme.AspNet.Data along with DevExtreme ASP.NET MVC Wrappers, you do not need to implement the custom model binder, because it is already done in the ASP.NET MVC Wrappers library.

Controller Example

Client-Side Method

To reach the controller from the client side, use the DevExpress.data.AspNet.createStore method. It accepts an object with the following fields.

  • key - the key property;
  • loadUrl - the URL used to load data;
  • loadParams - additional parameters that should be passed to loadUrl;
  • updateUrl - the URL used to update data;
  • insertUrl - the URL used to insert data;
  • deleteUrl - the URL used to delete data;
  • updateMethod - the HTTP method for update requests; "PUT" by default;
  • insertMethod - the HTTP method for insert requests; "POST" by default;
  • deleteMethod - the HTTP method for delete requests; "DELETE" by default;
  • onBeforeSend - a function that customizes the request before it is sent; accepts the following parameters:
    • operation: string
      The operation to be performed by the request. Can be "load", "update", "insert" or "delete".
    • jQueryAjaxSettings: object
      Settings configuring the request. For details, refer to the jQuery.ajax() description.

You can find an example here.

DevExtreme ASP.NET MVC Wrappers call the DevExpress.data.AspNet.createStore method internally. To configure the parameters, use the lambda expression of the DataSource() method.

@(Html.DevExtreme().DataGrid()
    .DataSource(ds => ds.WebApi()
        .Controller("NorthwindContext")
        .Key("OrderID")
        .LoadAction("GetAllOrders")
        .InsertAction("InsertOrder")
        .UpdateAction("UpdateOrder")
        .DeleteAction("RemoveOrder")
    )
)

See Also

devextreme.aspnet.data's People

Contributors

alekseymartynov avatar romantsukanov avatar roman-simionov avatar san4es avatar jsdmitry avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.