SfGrid Adaptors.UrlAdaptor adding header authorization (Blazor 18.2.44)


Hi,

Could you please show me the proper way on using SfGrid header authorization when using Adaptors.UrlAdaptor.
Backend I am using ASP.NET core API with jwt token.

I am able to get data from API using following header implementation.
Bt its not working on Syncfusion.Blazor.Grids.FilterType.Menu. I am getting following error

Full code with backend API
<SfGrid @ref="Grid1" TValue="SystemUserList" AllowPaging="true" AllowFiltering="true" Width="auto">
            <GridEvents TValue="SystemUserList" OnActionFailure="@ActionFailure" CommandClicked="@OnCommandClicked" />
            <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu" />
            <GridPageSettings PageSize="12" />
            <SfDataManager Headers="@HeaderData" Url="/api/systemuserlist" Adaptor="Adaptors.UrlAdaptor" />
            <GridColumns>
                <GridColumn Field=@nameof(SystemUserList.Id) Visible="false" />
                <GridColumn Field=@nameof(SystemUserList.Username) HeaderText="Username" Width="120" />
                <GridColumn Field=@nameof(SystemUserList.DisplayName) HeaderText="Name" Width="120" />
                <GridColumn HeaderText="Manage Records" Width="150">
                    <GridCommandColumns>
                        <GridCommandColumn Type="CommandButtonType.None" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-role", CssClass = "e-flat" })" />
                        <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat" })" />
                        <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat", })" />
                    </GridCommandColumns>
                </GridColumn>
            </GridColumns>
        </SfGrid>
@code {
    private IDictionary<stringstring> HeaderData = new Dictionary<stringstring>();
    protected override async void OnInitialized()
    {
       HeaderData.Add("Authorization""bearer " + await AuthenticationStateProvider.GetTokenAsync());
    }
}
 [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    public class SystemUserListController : ControllerBase
    {
        private readonly Context _db;
 
        public SystemUserListController(Context db)
        {
            _db = db;
        }
 
        [HttpPost]
        public object Post([FromBodyDataManagerRequest dm)
        {
            IQueryable<SystemUserList> DataSource = _db.SystemUser.Select(x => new SystemUserList
            {
                Id = x.Id,
                Username = x.Username,
            }).AsNoTracking();
 
            DataResult DataObject = new DataResult();
 
            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);
            }
            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)
            {
                //Paging
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);
            }
            if (dm.Take != 0)
            {
                DataSource = DataOperations.PerformTake(DataSource, dm.Take);
            }
 
            return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource;
        }
    }


3 Replies 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team July 14, 2020 05:23 PM UTC

Hi Ashimaz, 
 
Greetings from Syncfusion. 
 
We have validated the reported problem at our end. We confirmed “Menu filter is not working properly with authorization header and URL adaptor” as a bug and logged a defect report for the same. Thank you for taking the time to report this issue 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  weekly patch release which is expected to be rolled out on or before July 22, 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.   
 
 
Until then we appreciate your patience. 
 
Regards, 
Rahul 
 


Marked as answer

AS ashimaz July 15, 2020 04:59 PM UTC

Thank you, waiting for next update.


VN Vignesh Natarajan Syncfusion Team July 16, 2020 06:14 AM UTC

Hi Ashimaz,  

Thanks for the update. 

We will get back to you once our weekly Nuget (Patch) release gets successfully rolls out. 

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon