We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

EjsGrid use different model on CRUD operations

Thread ID:





150628 Jan 14,2020 06:13 AM UTC Jan 15,2020 03:43 AM UTC Blazor 1
Tags: Grid
Asked On January 14, 2020 06:13 AM UTC


I'm wondering if is it possible to use different model on CRUD operations?

My current situation:
I'm using grid to display vehicle statistic and I using  statistics model, but performing CRUD operations I need to use different model, because I need to have different data about vehicle.

Right now all I able to achieve is use different Url's as you can see below:
<EjsGrid AllowPaging="true" AllowSorting="true" AllowSelection="true" TValue="VehicleListModel" Toolbar="@(new List<string>() { "Search", "Add", "Edit", "Delete" })">
    <EjsDataManager Url="https://localhost:25012/api/VehicleStats" CrudUrl="https://localhost:25012/api/Vehicle" CrossDomain="true" Adaptor="Adaptors.ODataV4Adaptor" Offline="true"></EjsDataManager>
    <GridSearchSettings Fields="@(new string[] { "Number" })" Operator="@Operator.Contains" IgnoreCase="true"></GridSearchSettings>
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog" ShowDeleteConfirmDialog="true"></GridEditSettings>
    <GridPageSettings PageCount="5"></GridPageSettings>
        <GridColumn Field="@nameof(VehicleListModel.Id)" HeaderText="ID" IsPrimaryKey="true" TextAlign="@TextAlign.Left"></GridColumn>
        <GridColumn Field="@nameof(VehicleListModel.Number)" HeaderText="Name" TextAlign="@TextAlign.Justify"></GridColumn>
        <GridColumn Field="@nameof(VehicleListModel.FilesCount)" HeaderText="Files" TextAlign="@TextAlign.Center"></GridColumn>
        <GridColumn Field="@nameof(VehicleListModel.ActiveScheduleCount)" HeaderText="Schedules" TextAlign="@TextAlign.Right"></GridColumn>

Vignesh Natarajan [Syncfusion]
Replied On January 15, 2020 03:43 AM UTC

Hi Laimis,  
Greetings from Syncfusion support.  
Query: “but performing CRUD operations I need to use different model, because I need to have different data about vehicle. 
Yes, you can use different model class in the WebAPI service, but that alternate model must have properties similar to model class define in Grid data. Because while performing CRUD operations we will send the PUT, POST, DELETE request along the with modified data (as object) to server. Based on the model class defined in the server, data will be serialized if your alternate model class has similar properties. 
But in your code example, you have used Offline property of EjsDataManager as true. While enabling that property all the Grid actions like filtering, sorting, CRUD will take place locally. No request will be sent to server for data operations. Because Offline property is used to bind the remote data locally to Grid.  
Kindly get back to us if you have further queries.  
Vignesh Natarajan. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon