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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataOperations

Thread ID:

Created:

Updated:

Platform:

Replies:

145612 Jul 1,2019 10:07 AM UTC Dec 29,2019 11:50 AM UTC Blazor 32
loading
Tags: Grid
Costa
Asked On July 2, 2019 10:17 AM UTC

Hey. Is it possible to use the DataOperations and DataManagerRequest in Blazor Application?
Thanks.

Vignesh Natarajan [Syncfusion]
Replied On July 2, 2019 11:36 AM UTC

Hi Costa,  

Thanks for contacting Syncfusion forums.  

Query: “Is it possible to use the DataOperations class in Blazor? 

Before proceeding with your query, we need some additional details regarding your query. So kindly share the following details  

  1. In Blazor sample where you want to use the DataOperations class?. Also share your use case scenario of your requirement.
  2. Do you want to use DataOperations class to perform operations like Sorting, Filtering, Paging in Grid component? If not mention the component you want to use this class.
  3. Using dataOperations class do you want to customize the default actions?
  4. Share more details about your requirement.  

The requested details will be helpful for us to validate the reported query and provide the solution as early as possible.  

Regards, 
Vignesh Natarajan. 


Costa
Replied On July 2, 2019 01:04 PM UTC

Vignesh Natarajan: "2. Do you want to use DataOperations class to perform operations like Sorting, Filtering, Paging in Grid component?"- Yes.
 
For some reason, I cannot insert sample code into the message. I get:
You have tried to enter a word or URL that is not allowed on this site. If you believe that this is inaccurate, please contact us at support@syncfusion.com.

Therefore, in the attachment, I put an example project on Razor Pages.

Can we do something similar in Blazor?

Attachment: RazorpagesFilter_350e5299_8d8b9e82.zip

P.S. I mean: "public JsonResult OnPostDataSource([FromBody]DataManagerRequest dm)" in Index.cshtml.cs

Vignesh Natarajan [Syncfusion]
Replied On July 3, 2019 02:52 PM UTC

Hi Costa,  

Thanks for the update.  

We have analyzed the provided sample and found that you have used UrlAdaptor to bind dataSource to Grid in RazorPages sample. By default Blazor Grid will adapt the Blazor Adaptor to bind the dataSource to Grid if the dataSource is in form of array of objects / IEnumerable.  

BlazorAdaptor is one which helps to bind data to datasource in OnDemand basis even though the dataSource is in the form of Collection of data/IEnumerable. It will fetch and bind the current page data only to the component. By in-built we have handled the actions like CRUD, Filtering, Sorting Paging and etc using the Blazor Adaptor.  DataOperations like filtering, Sorting, Searching will be handled internally in similar manner to URL Adaptor’s using DataOperations methods (PerformFiltering, PerformSorting, PerformSearching, PerformSkip etc)

Note: It is not necessary to define the BlazorAdaptor in datamanager as like other adaptors which we have processed in-built. It is enough to bind the dataSource to Grid. 

Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


Uwe Hein
Replied On July 4, 2019 07:02 AM UTC

Hi,

   will this also work in scheduler ? I need to perform CRUD operations in a server-side blazor app on the scheduler and do not know how to get started.

    regards

        Uwe

Costa
Replied On July 7, 2019 09:48 PM UTC

Hi! How can I perform paging in Blazor with lazy loading from Sql Server using BlazorAdaptor, or in another way? If possible, please give me an example.

Vignesh Natarajan [Syncfusion]
Replied On July 10, 2019 11:36 AM UTC

Hi Uwe, 
 
Thanks for contacting Syncfusion forums. 
 
Query: “I need to perform CRUD operations in a server-side blazor app on the scheduler and do not know how to get started.  
 
We have prepared a sample to perform CRUD actions in Scheduler using ODataV4Adaptor for your reference which can be downloaded from the following link.  
 
 
@using Syncfusion.EJ2.Blazor  
@using Syncfusion.EJ2.Blazor.Schedule  
@using Syncfusion.EJ2.Blazor.Data  
  
<EjsSchedule ID="schedule" Height="550px" SelectedDate="new DateTime(2018, 5, 10)">  
    <ScheduleEventSettings>  
        <EjsDataManager Url="http://localhost:25255/odata/EventDatas"Adaptor="Adaptors.ODataV4Adaptor"></EjsDataManager>  
    </ScheduleEventSettings>  
</EjsSchedule>  
 
Service 
 
public class EventDatasController : ODataController  
    {  
        private ScheduleDataEntities1 db = new ScheduleDataEntities1();  
  
        // GET: odata/EventDatas  
        [EnableQuery]  
        [AcceptVerbs("GET")]  
        public IQueryable<EventData> GetEventDatas()  
        {  
            return db.EventDatas;  
        }  
  
        // GET: odata/EventDatas(5)  
        [EnableQuery]  
        [AcceptVerbs("GET")]  
        public IQueryable<EventData> GetEventDatas(string StartDate, string EndDate)  
        {  
            DateTime start = DateTime.Parse(StartDate);  
            DateTime end = DateTime.Parse(EndDate);  
            return db.EventDatas.Where(evt => evt.StartTime >= start && evt.EndTime <= end);  
        }  
  
        // POST: odata/EventDatas  
        [AcceptVerbs("POST", "OPTIONS")]  
        public void Post([FromBody]CrudData eventData)  
        {  
            EventData insertData = new EventData();  
            insertData.Id = (db.EventDatas.ToList().Count > 0 ? db.EventDatas.ToList().Max(p => p.Id) : 1) + 1;  
            insertData.StartTime = Convert.ToDateTime(eventData.StartTime).ToLocalTime();  
            insertData.EndTime = Convert.ToDateTime(eventData.EndTime).ToLocalTime();  
            insertData.Subject = eventData.Subject;  
            insertData.IsAllDay = eventData.IsAllDay;  
            insertData.Location = eventData.Location;  
            insertData.Description = eventData.Description;  
            insertData.RecurrenceRule = eventData.RecurrenceRule;  
            insertData.RecurrenceID = eventData.RecurrenceID;  
            insertData.RecurrenceException = eventData.RecurrenceException;  
            insertData.StartTimezone = eventData.StartTimezone;  
            insertData.EndTimezone = eventData.EndTimezone;  
  
            db.EventDatas.Add(insertData);  
            db.SaveChanges();  
        }  
  
        // PATCH: odata/EventDatas(5)  
        [AcceptVerbs("PATCH", "MERGE", "OPTIONS")]  
        public void Patch([FromBody]CrudData eventData)  
        {  
            EventData updateData = db.EventDatas.Find(Convert.ToInt32(eventData.Id));  
            if (updateData != null)  
            {  
                updateData.StartTime = Convert.ToDateTime(eventData.StartTime).ToLocalTime();  
                updateData.EndTime = Convert.ToDateTime(eventData.EndTime).ToLocalTime();  
                updateData.Subject = eventData.Subject;  
                updateData.IsAllDay = eventData.IsAllDay;  
                updateData.Location = eventData.Location;  
                updateData.Description = eventData.Description;  
                updateData.RecurrenceRule = eventData.RecurrenceRule;  
                updateData.RecurrenceID = eventData.RecurrenceID;  
                updateData.RecurrenceException = eventData.RecurrenceException;  
                updateData.StartTimezone = eventData.StartTimezone;  
                updateData.EndTimezone = eventData.EndTimezone;  
  
                db.SaveChanges();  
            }  
        }  
  
        // DELETE: odata/EventDatas(5)  
        [AcceptVerbs("DELETE", "OPTIONS")]  
        public void Delete([FromODataUri]int key)  
        {  
            EventData removeData = db.EventDatas.Find(key);  
            if (removeData != null)  
            {  
                db.EventDatas.Remove(removeData);  
                db.SaveChanges();  
            }  
        }  
    }  
 
Please get back to us if you have any other queries.   
 
Regards, 
Vignesh Natarajan. 


Vignesh Natarajan [Syncfusion]
Replied On July 10, 2019 11:37 AM UTC

Hi Costa,  

Query: “How can I perform paging in Blazor with lazy loading from Sql Server using BlazorAdaptor, or in another way? 

As per your requirement we have prepared a sample to bind the dataSource to Grid from SQL server using SqlDataAdaptor. Kindly refer the below code example. 

<EjsGrid id="Grid" @ref="grid" AllowPaging="true" DataSource="@griddata"> 
    <GridColumns> 
………………………………………………. 
    </GridColumns> 
</EjsGrid> 
 
………………………………………………. 
 
 
@code{ 
    EjsGrid grid; 
    public List<Orders> griddata = new List<Orders>(); 
    public DataTable dt = new DataTable("Order"); 
    protected override void OnInit() 
    { 
        //use your connection string here 
        string connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='D:\Blazor Samples\SqlServer\SqlServer\SqlServer\Data\NORTHWND.MDF';Integrated Security=True;Connect Timeout=30"; 
        SqlConnection myConnection = new SqlConnection(connectionString); 
        dt = new DataTable("Order"); 
        SqlCommand cmd = new SqlCommand(); 
        cmd.Connection = myConnection; 
        cmd.CommandText = "select * from Orders"; 
        cmd.CommandType = CommandType.Text; 
        SqlDataAdapter da = new SqlDataAdapter(); 
        da.SelectCommand = cmd; 
        if (myConnection.State == ConnectionState.Closed) 
        { 
            myConnection.Open(); 
        } 
        da.Fill(dt); 
        dataBind(); 
    } 
 
    protected void dataBind() 
    { 
        foreach (DataRow row in dt.Rows) 
        { 
            griddata.Add(new Orders 
            { 
                OrderID = Convert.ToInt32(row["OrderID"]), 
                CustomerID = row["CustomerID"].ToString(), 
                EmployeeID = Convert.ToInt32(row["EmployeeID"]), 
                …………………………………………………………………… 
            }); 
        } 
    } 
    public class Orders 
    { 
        public Orders() 
        { 
 
        } 
        public Orders(int orderId, string customerId, int empId, double freight, string shipName, string shipCountry) 
        { 
……………………………………………………… 
        } 
        public int OrderID { get; set; } 
        public string CustomerID { get; set; } 
        public int EmployeeID { get; set; } 
        public double Freight { get; set; } 
        public string ShipName { get; set; } 
        public string ShipCountry { get; set; } 
    } 
 
} 

Kindly download the sample from below link 


Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan.

Uwe Hein
Replied On July 11, 2019 05:52 PM UTC

Hi Vignesh,

  thank you very much for the scheduler CRUD sample. I works as it should - here are some questions:

1. Do you always need a controller class for the connection to the data ? As I am working in server-side blazor a controller usually is not necessary to manipulate the data.
2. Is there any documentation on the other adaptors - especially BlazorAdaptor and how to use them ?
3. We are not using EntityFramework but Dapper - so would'nt e.g. WebApiAdaptor be a better choice ?

   thanks for your effort

      regards

         Uwe Hein

Costa
Replied On July 14, 2019 01:09 PM UTC

Thank. Probably I did not quite accurately formulated the question. Basic requirement: lazy loading. But in the proposed example, lazy loading is not implemented. How to implement lazy loading in Blazor using Syncfusion? Maybe all the same using DataOperations?
P.S. Mostly, I use Entity Framework and Sql Server.
P.P.S. Is it possible to use UrlAdaptor and DataOperations with EJ2.Blazor (like Razor Pages ASP.NET Core-EJ2)? 

Something like that:

        public IActionResult UrlDatasource([FromBody]DataManagerRequest dm)
        {
            IQueryable DataSource = MappingFunction(db.Orders.OrderBy(e=>e.EmployeeID));
            DataOperations operation = new DataOperations();
            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Count();
            if (dm.Skip != 0)
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }
            return dm.RequiresCounts ? Json(new { result = DataSource, count}) : Json(DataSource);
        }



If possible, show how to do it. Or explain how to implement lazy loading in another way in EJ2.Blazor.


Costa
Replied On July 15, 2019 01:12 PM UTC

How to insert the tag-helpers-code in the message? I always get the error:

You have tried to enter a word or URL that is not allowed on this site. If you believe that this is inaccurate, please contact us at support@syncfusion.com.

Vignesh Natarajan [Syncfusion]
Replied On July 16, 2019 03:15 PM UTC

Hi Costa,  

Query1: “ Is it possible to use UrlAdaptor and DataOperations with EJ2.Blazor (like Razor Pages ASP.NET Core-EJ2)?  

Yes. As per your requirement we have achieved the lazy loading concept in Blazor using WebAPI Post method and UrlAdaptor. Kindly download the sample from below  


Refer the below code example for your reference.   
 
[Index.razor] 
<EjsGrid @ref="@grid" AllowPaging="true"> 
    <EjsDataManager Url="/api/Default" Adaptor="Adaptors.UrlAdaptor"></EjsDataManager> 
    <GridColumns> 
        <GridColumn Field="OrderID" HeaderText="Employee ID" ISPrimaryKey="true" TextAlign="@TextAlign.Right" Width="90"></GridColumn> 
        <GridColumn Field="CustomerID" HeaderText="First Name" Width="90"></GridColumn> 
        <GridColumn Field="EmployeeID" HeaderText="Employee ID" Width="90"></GridColumn> 
        <GridColumn Field="Freight" HeaderText="Freight" Width="90"></GridColumn> 
    </GridColumns> 
</EjsGrid> 

[DefaultController

We have used DataManagerRequest class to serialize the objects and performed the certain action using DataOperations class.  

[HttpPost] 
        public object Post([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = db.GetAllOrders().ToList();            
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<Order>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = DataOperations.PerformTake(DataSource, dm.Take); 
            } 
            return new { result = DataSource, count = count }; 
 
        }        

Query2: “How to insert the tag-helpers-code in the message? I always get the error:’” 

Sorry for the inconvenience.  

We have confirmed this reported query as a bug and logged a defect report for the same. Fix for the issue will be refreshed online as soon as possible.  Until then you can copy your code example into the file and share it as attachment if our support system does not accept your codes.  

Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


Costa
Replied On July 17, 2019 10:02 AM UTC

Thanks for the example. If you will allow, one more question. Is it possible to use a similar approach in the Blazor application created using the 'Blazor Server App' template? I can't make it work.

Vignesh Natarajan [Syncfusion]
Replied On July 18, 2019 11:19 AM UTC

Hi Costa,  

Thanks for the update.  

Query: “Is it possible to use a similar approach in the Blazor application created using the 'Blazor Server App' template?  

Yes. You can use the similar approach in Blazor server Application. But one difference is that you need to use two application. (i.e) Hosted Application to handle the Controller page and Blazor Server Application to render the Grid. Once configured you can specify the URL directly in the Url property of EjsDataManager.  

Refer the below code example  

<EjsGrid id="Grid" @ref="@grid" AllowPaging="true" AllowSorting="true" AllowFiltering="true" toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Cancel", "Update" })"> 
<EjsDataManager Url=" http://localhost:51972/api/Default" Adaptor="Adaptors.UrlAdaptor"></EjsDataManager>    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Normal"></GridEditSettings> 
    <GridColumns> 
       ………………………………………….. 
    </GridColumns> 
</EjsGrid> 

Note: http://localhost:51972/api/Default represent the controller page in another application (Blazor Hosted Application).  

Please get back to us if you have further queries.   

Regards, 
Vignesh Natarajan. 


ashimaz
Replied On November 16, 2019 12:00 AM UTC

Provided EjsDataManager code works fine with Blazor .Net Core 3, but my only issue is this is not efficient for large database tables, since have to use  IEnumerable DataSource = db.GetAllOrders().ToList(); before Search or Filter.

When I remove ToList() its giving me following error as expected.
System.InvalidOperationException: The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
How to use this efficiently using IQueryable with large database tables ??

Costa
Replied On November 16, 2019 03:58 AM UTC

Hi. DataOperations сlass have both IEnumerable and IQueryable method versions.
I did not find any problems with IQeryable:

    // Implementing custom adaptor by extending the DataAdaptor class
    public class MovieAdaptor : DataAdaptor
    {
        readonly ApplicationDbContext db;
        public IQueryable Movies { get; set; }

        public MovieAdaptor(ApplicationDbContext db)
        {
            this.db = db;
            Movies = db.Movies;
        }

// Performs data Read operation
        public override object Read(DataManagerRequest dm) 
        {
            var DataSource = Movies; //or  DataSource = db.Movies; or  DataSource = Movies.Where(e=> ...;
               //DataSource is IQueryable
            if (dm.Search != null && dm.Search.Count > 0)
            {
                // Searching
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search);
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)
            {
                // Sorting
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
            }
...

Here, the code is based on the implementation of the CustomAdaptor. But also in other cases I did not encounter problems when using IQueryable and DataOperations.

ashimaz
Replied On November 16, 2019 04:59 AM UTC

System.InvalidOperationException: The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.

Above error occurs when search do a post to web api.

Blazor Code

<EjsGrid TValue="SystemUserList" AllowPaging="true" Toolbar="@(new List<string>() { "Search"})">

                    <GridEvents TValue="SystemUserList" OnActionFailure="@ActionFailure" CommandClicked="@OnCommandClicked" RowDataBound="RowBound" ></GridEvents>

                    <EjsDataManager Url="https://localhost:44365/api/systemuser" Adaptor="Adaptors.UrlAdaptor"></EjsDataManager>

                    <GridColumns>

                        <GridColumn Field=@nameof(SystemUserList.Id) HeaderText="ID" Width="50"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.Username) HeaderText="Username" Width="100"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.DisplayName) HeaderText="DisplayName" Width="100"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.Email) HeaderText="Email" Width="150"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.Mobile) HeaderText="Mobile" Width="80"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.LastLoginDate) HeaderText="LastLoginDate" Width="100" Format="yMd"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.LastPasswordChanged) HeaderText="LastPasswordChanged" Width="100" Format="yMd"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.SystemIp) HeaderText="SystemIp" Width="100"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.IsAdmin) HeaderText="IsAdmin" Width="50" DisplayAsCheckBox="true"></GridColumn>

                        <GridColumn Field=@nameof(SystemUserList.IsDisabled) HeaderText="IsDisabled" Width="50" DisplayAsCheckBox="true"></GridColumn>

                        <GridColumn TextAlign="TextAlign.Right" Width="50">

                            <GridCommandColumns>

                                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Edit", CssClass = "btn btn-square btn-block btn-warning" })"></GridCommandColumn>

                            </GridCommandColumns>

                        </GridColumn>

                        <GridColumn TextAlign="TextAlign.Right" Width="60">

                            <GridCommandColumns>

                                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Delete", CssClass = "btn btn-square btn-block btn-danger" })"></GridCommandColumn>

                            </GridCommandColumns>

                        </GridColumn>

                    </GridColumns>

                </EjsGrid>


Web API Code

[HttpPost]

        public object Post([FromBody] DataManagerRequest dm)

        {

            IEnumerable dataSource = _db.SystemUser.Select(x => new SystemUserList

            {

                Id = x.Id,

                Username = x.Username,

                DisplayName = x.DisplayName,

                Email = x.Email,

                Mobile = x.Mobile,

                LastLoginDate = x.LastLoginDate,

                LastPasswordChanged = x.LastPasswordChanged,

                SystemIp = x.SystemIp,

                IsAdmin = x.IsAdmin,

                IsDisabled = x.IsDisabled,

                SystemName = x.SystemName,

            });


            if (dm.Search != null && dm.Search.Count > 0)

            {

                dataSource = DataOperations.PerformSearching(dataSource, dm.Search);  //Search

            }

            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting

            {

                dataSource = DataOperations.PerformSorting(dataSource, dm.Sorted);

            }

            if (dm.Where != null && dm.Where.Count > 0) //Filtering

            {

                dataSource = DataOperations.PerformFiltering(dataSource, dm.Where, dm.Where[0].Operator);

            }

            int count = dataSource.Cast<SystemUserList>().Count();

            if (dm.Skip != 0)

            {

                dataSource = DataOperations.PerformSkip(dataSource, dm.Skip);   //Paging

            }

            if (dm.Take != 0)

            {

                dataSource = DataOperations.PerformTake(dataSource, dm.Take);

            }

            return new { result = dataSource, count = count };

        }


Not sure how I can use CustomAdaptor on above code. I am using .Net Core 3 with Syncfusion 17.3.0.18.



Costa
Replied On November 16, 2019 10:09 AM UTC

If you want to use IQueryable, why create an IEnumerable data source?
Syncfusion examples probably confuse a lot of people, using IEnumerable to simplify.

Try:

[HttpPost]

        public object Post([FromBody] DataManagerRequest dm)

        {

            IEnumerable dataSource = _db.SystemUser.Select(x => new SystemUserList

            {

                Id = x.Id,

     var dataSource = _db.SystemUser;

... etc.


Modify the  TValue= ...> accordingly.


ashimaz
Replied On November 16, 2019 01:38 PM UTC

Hi, I already tried with IQueryable, but search did not work. Please find modified IQueryable code which gives about error.

Blazor
<EjsGrid TValue="SystemUserList" AllowPaging="true" Toolbar="@(new List<string>() { "Search"})">
                    <GridEvents TValue="SystemUserList" OnActionFailure="@ActionFailure" CommandClicked="@OnCommandClicked" RowDataBound="RowBound"></GridEvents>
                    <EjsDataManager Url="https://localhost:44365/api/systemuser" Adaptor="Adaptors.UrlAdaptor"></EjsDataManager>
                    <GridColumns>
                        <GridColumn Field=@nameof(SystemUserList.Id) HeaderText="ID" Width="50"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.Username) HeaderText="Username" Width="100"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.DisplayName) HeaderText="DisplayName" Width="100"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.Email) HeaderText="Email" Width="150"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.Mobile) HeaderText="Mobile" Width="80"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.LastLoginDate) HeaderText="LastLoginDate" Width="100" Format="yMd"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.LastPasswordChanged) HeaderText="LastPasswordChanged" Width="100" Format="yMd"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.SystemIp) HeaderText="SystemIp" Width="100"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.IsAdmin) HeaderText="IsAdmin" Width="50" DisplayAsCheckBox="true"></GridColumn>
                        <GridColumn Field=@nameof(SystemUserList.IsDisabled) HeaderText="IsDisabled" Width="50" DisplayAsCheckBox="true"></GridColumn>
                        <GridColumn TextAlign="TextAlign.Right" Width="50">
                            <GridCommandColumns>
                                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Edit", CssClass = "btn btn-square btn-block btn-warning" })"></GridCommandColumn>
                            </GridCommandColumns>
                        </GridColumn>
                        <GridColumn TextAlign="TextAlign.Right" Width="60">
                            <GridCommandColumns>
                                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Delete", CssClass = "btn btn-square btn-block btn-danger" })"></GridCommandColumn>
                            </GridCommandColumns>
                        </GridColumn>
                    </GridColumns>
                </EjsGrid>


Web API
[HttpPost]
        public object Post([FromBodyDataManagerRequest dm)
        {
            var dataSource = _db.SystemUser.Select(x => new SystemUserList
            {
                Id = x.Id,
                Username = x.Username,
                DisplayName = x.DisplayName,
                Email = x.Email,
                Mobile = x.Mobile,
                LastLoginDate = x.LastLoginDate,
                LastPasswordChanged = x.LastPasswordChanged,
                SystemIp = x.SystemIp,
                IsAdmin = x.IsAdmin,
                IsDisabled = x.IsDisabled,
                SystemName = x.SystemName,
            });
 
            if (dm.Search != null && dm.Search.Count > 0)
            {
                dataSource = DataOperations.PerformSearching(dataSourcedm.Search);  //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0//Sorting
            {
                dataSource = DataOperations.PerformSorting(dataSourcedm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0//Filtering
            {
                dataSource = DataOperations.PerformFiltering(dataSourcedm.Where, dm.Where[0].Operator);
            }
            int count = dataSource.Cast<SystemUserList>().Count();
            if (dm.Skip != 0)
            {
                dataSource = DataOperations.PerformSkip(dataSourcedm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                dataSource = DataOperations.PerformTake(dataSourcedm.Take);
            }
            return new { result = dataSource, count = count };

Costa
Replied On November 17, 2019 03:32 AM UTC

Yeah, it is. This is probably a Syncfusion error when implementing DataOperations.PerformFiltering for Blazor and "startswith," endswith, "contains" operators. It appears that an error occurs for both IEnumerable and IQueryable.

Costa
Replied On November 17, 2019 05:04 AM UTC

I created a new thread on this topic.

Renjith Singh Rajendran [Syncfusion]
Replied On November 18, 2019 01:21 PM UTC

Hi Costa/ashimaz, 

Thanks for your updates. 

We have already considered this as a usability feature improvement “Problem with DataOperations when bind IQueryable data to Grid”, and logged a task for the same.    
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.   

We have planned to implement this feature in our Volume 4, 2019 release. Until then we suggest you to bind List values to Grid to overcome the problem you are facing.  

Please refer the below code example. 

 
public Object Post([FromBody]DataManagerRequest dm) 
        { 
            // Here we have converted dataSource as list to resolve the problem 
            IEnumerable DataSource = db.Orders.Select(x => new Order 
            { 
                OrderID = x.OrderID, 
                EmployeeID = x.EmployeeID, 
                CustomerID = x.CustomerID 
            }).ToList(); 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<Order>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = DataOperations.PerformTake(DataSource, dm.Take); 
            } 
            return new { result = DataSource, count = count }; 
        } 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


ashimaz
Replied On November 19, 2019 03:55 PM UTC

Thank you for the update and support.

Renjith Singh Rajendran [Syncfusion]
Replied On November 20, 2019 05:27 AM UTC

Hi ashimaz, 

We are glad to hear that the provided suggestion resolved your problem. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


ashimaz
Replied On December 21, 2019 04:43 AM UTC

Hi, This issue still exist in 17.4.0.39, any update on this?

I tried using CustomAdaptor, still same issue.

Costa
Replied On December 21, 2019 09:37 AM UTC

Hi, ashimaz. It was said:
"We have planned to implement this feature in our Volume 4, 2019 release"

Costa
Replied On December 21, 2019 09:39 AM UTC

Moreover, I was informed that:
"The Volume 4, SP1 release is scheduled to roll out by the end of January 2020. Until then we appreciate your patience."

ashimaz
Replied On December 21, 2019 02:00 PM UTC

OK I was informed it will be fixed in Vol 4, will wait for Vol 4 SP1.

Thank you for the update and support.

Costa
Replied On December 22, 2019 11:38 PM UTC

Hi, ashimaz. By the way, you're right. Indeed, the fix has been promised in "Volume 4, 2019 release", rather than "Volume 4 SP1". Therefore, it would be nice to have the official word Syncfusion support.

Costa
Replied On December 23, 2019 10:44 AM UTC


Renjith Singh Rajendran [Syncfusion]
Replied On December 23, 2019 01:52 PM UTC

Hi Costa/ashimaz, 

We are sorry for the inconvenience caused. 

Due to some unforeseen circumstances, we could not include the fix for this issue in our Volume 4, 2019 release. But we will fix this and the fix for the issue will be available in our upcoming patch release which is expected to roll out on or before 14th January 2020. Till then we appreciate your patience. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


ashimaz
Replied On December 24, 2019 04:25 AM UTC

Renjith, Thank you for the update and support. I will wait for next update.
As I am working on blazor components, I will keep reporting issues I find.


Renjith Singh Rajendran [Syncfusion]
Replied On December 29, 2019 11:50 AM UTC

Hi ashimaz, 

Thanks for your update. 

Please get back to us if you need further assistance. We will be happy to assist you. 

Regards, 
Renjith Singh Rajendran. 


CONFIRMATION

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