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

search button

Thread ID:

Created:

Updated:

Platform:

Replies:

151338 Feb 7,2020 08:25 AM UTC Apr 6,2021 11:29 AM UTC Blazor 7
loading
Tags: Grid
Stefano Capobianco
Asked On February 7, 2020 08:25 AM UTC

Hi, in my grid i've enabled the toolbar with the search button:

<EjsGrid TValue="Title" AllowPaging="true" Query="@GridQuery" Toolbar="@Tool" GridLines="GridLine.Both" EnableAltRow="true">
    <EjsDataManager Url="https://localhost:44319/Titles/Gets" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
    <GridSearchSettings Fields="@SpecificCols" IgnoreCase="true" Operator="Operator.Contains"></GridSearchSettings>
    <GridEvents CommandClicked="OnCommandClicked" TValue="Title"></GridEvents>
    <GridPageSettings PageSize="5" PageSizes="true"></GridPageSettings>
    <GridColumns>
        <GridColumn Field=@nameof(Title.Id) HeaderText="Title Id" TextAlign="TextAlign.Center" Width="10" Visible="false"></GridColumn>
        <GridColumn Field=@nameof(Title.TitleAbbreviated) HeaderText="Abbreviazione" TextAlign="TextAlign.Center" Width="10"></GridColumn>
        <GridColumn Field=@nameof(Title.TitleName) HeaderText="Titolo" TextAlign="TextAlign.Center" Width="10" AllowSearching="true"></GridColumn>
        <GridColumn HeaderText="Azioni" TextAlign="TextAlign.Center" Width="10">
            <GridCommandColumns>
                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat", Content = "Edit" })"></GridCommandColumn>
                <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat", Content = "Delete" })"></GridCommandColumn>
            </GridCommandColumns>
        </GridColumn>
    </GridColumns>
</EjsGrid>

and there are the declaration inside code section

    public Query GridQuery { get; set; }
    public string[] SpecificCols = (new string[] { "TitleName" });
    public List<string> Tool = (new List<string>() { "Search", "Print" });

When i press the search button start the request to remote controller but in the querystring i've nothing about filter and if i need to add query parameter how can i handle search request ?

This is my remote controller

        [HttpGet]
        public async Task<IActionResult> Gets()
        {
            var queryString = Request.Query;
            
            string showDeleted = (queryString.TryGetValue("TitleDeleted", out StringValues TitleDeleted)) ? TitleDeleted[0] : null;
            
            if (queryString.Keys.Contains("$inlinecount"))
            {
                int skip = (queryString.TryGetValue("$skip", out StringValues Skip)) ? Convert.ToInt32(Skip[0]) : 0;
                int take = (queryString.TryGetValue("$top", out StringValues Take)) ? Convert.ToInt32(Take[0]) : 0;
                
                var titles = await _mediator.Send(new QueryTitles(skip, take, showDeleted));
                return new OkObjectResult(new { Items = _mapper.Map<IEnumerable<Title>>(titles), Count = await _mediator.Send(new QueryTitlesCount(showDeleted)) });
            }
            else
            {
                var titles = await _mediator.Send(new QueryTitles(0, 0, showDeleted));
                return new OkObjectResult(_mapper.Map<IEnumerable<Title>>(titles));
            }
 
        }

Thanks in advance
Stefano

Renjith Singh Rajendran [Syncfusion]
Replied On February 10, 2020 12:27 PM UTC

Hi Stefano, 

Thanks for contacting Syncfusion support. 

We have confirmed this as a defect and logged a defect report for the same. Thank you for taking the time to report this issue “Search predicates are not generated in $filter query in WebApiAdaptor” and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming bi-weekly release which is expected to be rolled out on or before March 11, 2020.  
  
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.  
 
Once the release is rolled out, you will get the search action query in the “Request.Query”. Please handle the search query($filter) in your WebApi service, based on the “Request.Query” you get from the request. 

 
        [HttpGet] 
        public object Get() 
        { 
            IQueryable<Projekte> data = db.GetAllProjektes().AsQueryable(); 
            var count = data.Count(); 
            var queryString = Request.Query;                  //Based on this request query, handle the search action. 
            string search = queryString["$filter"];          //get the search query here      
            ... 
       } 
 
 
Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Stefano Capobianco
Replied On February 10, 2020 02:14 PM UTC

Hi, thanks for your answer. 
It's possible to know if a temporary fixing for this problem was planned or it's necessary to wait for the update ?

Stefano

Renjith Singh Rajendran [Syncfusion]
Replied On February 11, 2020 12:51 PM UTC

Hi Stefano, 

Thanks for your update. 

Workaround is currently not possible for this issue. We believe you need this fix urgently hence we have created a custom nuget patch to resolve this issue. Please download the patch from the link below, 
 
We suggest you to clear the nuget cache and install the provided custom nuget from the above link in your application to resolve this problem. Please use this custom nuget patch till the March 11, 2020, release is rolled out. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Stefano Capobianco
Replied On February 11, 2020 01:18 PM UTC

Thanks for the patch, now the $filter query string parameter appear inside the webapi controller.

Little question: using this custom patch it's impossible to use the new package release (17.4.0.49) right ?

Thanks
Stefano

Renjith Singh Rajendran [Syncfusion]
Replied On February 12, 2020 01:46 PM UTC

Hi Stefano, 

Thanks for your update. 

Yes, in our latest version 17.4.0.49, the fix in the custom nuget patch will not be available. So, for your convenience, we have prepared the patch with our latest version 17.4.0.49. Please use the custom nuget patch from the link below, 
 
Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Abdul Qadir Ahmed Abbasi
Replied On April 5, 2021 09:26 AM UTC

Hi Syncfusion Team,

I hope you will find this in your best. I am working with "ODataV4Adaptor" + "SfGrid" in my Blazor app and found the same bug. I have "18.4.0.47"  version installed. I am able to see the "$search" in HttpContext.Request.Query , but it is not translated to "$filter". You are requested to kindly get back to me on this ASAP.


Kind Regards,

Abdul Qadir Ahmed Abbasi


Vignesh Natarajan [Syncfusion]
Replied On April 6, 2021 11:29 AM UTC

Hi Abdul,  
 
Thanks for contacting Syncfusion support.  
 
Query: “ am working with "ODataV4Adaptor" + "SfGrid" in my Blazor app and found the same bug. I have "18.4.0.47"  version installed. I am able to see the "$search" in HttpContext.Request.Query , but it is not translated to "$filter" 
 
We have analyzed the reported query and we understand that you are facing difficulties while performing search operation in Grid using ODataV4 adaptor. We would like to inform you that we have provided support to perform search operation in ODataV4 using $filter query in our 18.3.0.52 version patch release. 
 
Please find the release notes regarding the same from below  
 
 
To enable search operation in OData, we suggest you enable the EnableODataSearchFallback option in SfDataManager component using the OnAfterRender lifecycle event. Please use the below code in your application to perform search operations in Grid using $filter query string. 
 
<SfGrid TValue="Order" @ref="GridInstance" AllowPaging="true" Toolbar=@ToolbarItems AllowFiltering="true"> 
    <SfDataManager @ref="dm" Url="http://localhost:64956/odata/books" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager> 
. . . . .  
</SfGrid> 
  
@code{ 
    SfGrid<Order> GridInstance; 
    public SfDataManager dm{ getset; } 
  
    protected override void OnAfterRender(bool firstRender) 
    { 
        base.OnAfterRender(firstRender); 
        (dm.DataAdaptor as ODataV4Adaptor).Options.EnableODataSearchFallback = true; 
    } 
 
 
Limitation: Please find the following limitations applied for implementing this feature in your application. 
 
  1.  The contains operator will be applied only for string typed column
  2. The equal operator will only be applied for all other data types.
 
Please get back to us if you have further queries.  
 
Regards,
Vignesh Natarajan
 


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