gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
696 stars 134 forks source link

ItemsToDisplay #400

Open kimiyon27 opened 9 months ago

kimiyon27 commented 9 months ago

I am using to grid in asp.net mvc core there is an samples for ItemToDisplay in example application but don't know how display data in frontend I am using web and webapi facing problem in passing query to api and also passing ISGrid to web can't able to serialize and deserialize the data plz give me some help

gustavnavar commented 9 months ago

You must use the GridClient object in the front-end to display the ItemToDisplay serialized object sent by the back-end.

You can follow this guide: https://github.com/gustavnavar/Grid.Blazor/blob/master/docs/blazor_client/Quick_start.md

Mohammedyasith commented 9 months ago

Thank you @gustavnavar but now am facing another issue when ever I applying some filter the value was not passed to the api

var query = new QueryDictionary(); query.Add("grid-page", "2"); var client = new GridClient(HttpClient, url, query, false, "ordersGrid", Columns); _grid = client.Grid;

every time the query obj(query) we send from here is received not we applied one

Mohammedyasith commented 8 months ago

program.cs file services.AddHttpContextAccessor(); razor file

@inject IHttpContextAccessor HttpContextAccessor

   var query = HttpContextAccessor.HttpContext.Request.Query;
    var dictionary = ConvertToDictionary(query);
    var clients = new GridClient<WorkflowsModel>(HttpClient, "app/Data", dictionary, false, "appGrid", Columns)
                .Sortable()
                .Filterable()
                .WithMultipleFilters();

public static QueryDictionary ConvertToDictionary(IQueryCollection queryCollection) { var dictionary = new QueryDictionary();

    foreach (var kvp in queryCollection)
    {
        dictionary.Add(kvp.Key, kvp.Value);
    }
    return dictionary;
}
Mohammedyasith commented 8 months ago

Is this right

gustavnavar commented 8 months ago

I cant not see what is wrong in your code.

Could you open a new issue attaching the a visual studio project with your code?

Mohammedyasith commented 8 months ago

Its working fine