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

DataOperations

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

32 Replies

VN Vignesh Natarajan Syncfusion Team July 2, 2019 06:36 AM

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. 



CO Costa July 2, 2019 08:04 AM

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


VN Vignesh Natarajan Syncfusion Team July 3, 2019 09:52 AM

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. 



UH Uwe Hein July 4, 2019 02:02 AM

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


CO Costa July 7, 2019 04:48 PM

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.


VN Vignesh Natarajan Syncfusion Team July 10, 2019 06:36 AM

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. 



VN Vignesh Natarajan Syncfusion Team July 10, 2019 06:37 AM

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.


UH Uwe Hein July 11, 2019 12:52 PM

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


CO Costa July 14, 2019 08:09 AM

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.



CO Costa July 15, 2019 08:12 AM

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.


VN Vignesh Natarajan Syncfusion Team July 16, 2019 10:15 AM

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. 



CO Costa July 17, 2019 05:02 AM

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.


VN Vignesh Natarajan Syncfusion Team July 18, 2019 06:19 AM

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. 



AS ashimaz November 15, 2019 07:00 PM

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 ??


CO Costa November 15, 2019 10:58 PM

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.


AS ashimaz November 15, 2019 11:59 PM

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.




CO Costa November 16, 2019 05:09 AM

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.



AS ashimaz November 16, 2019 08:38 AM

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 };


CO Costa November 16, 2019 10:32 PM

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.


CO Costa November 17, 2019 12:04 AM

I created a new thread on this topic.


RS Renjith Singh Rajendran Syncfusion Team November 18, 2019 08:21 AM

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. 



AS ashimaz November 19, 2019 10:55 AM

Thank you for the update and support.


RS Renjith Singh Rajendran Syncfusion Team November 20, 2019 12:27 AM

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. 



AS ashimaz December 20, 2019 11:43 PM

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

I tried using CustomAdaptor, still same issue.


CO Costa December 21, 2019 04:37 AM

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


CO Costa December 21, 2019 04:39 AM

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."


AS ashimaz December 21, 2019 09:00 AM

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

Thank you for the update and support.


CO Costa December 22, 2019 06:38 PM

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.


CO Costa December 23, 2019 05:44 AM



RS Renjith Singh Rajendran Syncfusion Team December 23, 2019 08:52 AM

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. 



AS ashimaz December 23, 2019 11:25 PM

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.



RS Renjith Singh Rajendran Syncfusion Team December 29, 2019 06:50 AM

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. 


Loader.
Live Chat Icon For mobile
Up arrow icon