Grid Query

Hi there , i'm doing a little thing but i have a question for you 

I have a Grid with a query . From this grid i must take directly a filed that is the kay from one other grid 

I do not have to click on the first table to obtain the key for the second table as the first table will always consist of only one row. How do I get a datasource field from a query?


The query is done so : 


var Col1Pre = new WhereFilter(); // imposta filtro per query SYNC

var predicate = new List<WhereFilter>(); // lista dei filtri SYNC

                                         // primo filtro

predicate.Add(new WhereFilter() { Field = "OwnerOneId", value = args.Data.Id, Operator = "equal" });

// secondo filtro

predicate.Add(new WhereFilter() { Field = "OwnerTwoId", value = args.Data.Id, Operator = "equal" });

Col1Pre = WhereFilter.Or(predicate);

// SYNCFUSION query tree

OBOChatTreesDataSourceQuery = new Query().Where(Col1Pre);


1 Reply

PS Prathap Senthil Syncfusion Team November 21, 2024 01:24 PM UTC

Hi Francesco Pruneri,

Based on your query, we suspect that you want to retrieve the first grid's data. We suggest using the CurrentViewRecordsAsync method to get the details. Kindly refer to the code snippet and sample below for your reference.

<SfButton OnClick="GetCurrentRecord">GetCurrentRecord</SfButton>

 

<SfGrid DataSource="@Orders" @ref="Grid" AllowPaging="true">

</SfGrid>

 

@code {

 

    SfGrid<Order> Grid { get; set; }

 

 

    public async Task GetCurrentRecord()

    {

        var records = Grid.GetCurrentViewRecordsAsync();

      

    }

 


Sample:
https://blazorplayground.syncfusion.com/embed/rNLpMMriToAmzIqY?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

Reference:

Class SfGrid<TValue> - Blazor API Reference | Syncfusion

If it still doesn’t meet your requirements, kindly share more details about your requirements.


Regards,
Prathap Senthil


Loader.
Up arrow icon