Syncfusion components not interactive

Hi,

I want to set up two grids such that when I click on the higher one on a certain row, all of the associated entities are selected and displayed.
 Something like what is seen at the bottom of the   https://blazor.syncfusion.com/documentation/datagrid/row#detail-template at "Master Detail Datagrid" .

Even though I followed the steps in the example, it does not work as expected.

My code looks like this: 


<SfGrid  DataSource="Bets" AllowPaging="true" AllowSelection="true">
    <GridPageSettings PageSize="7"></GridPageSettings>
    <GridEvents RowSelected="RowSelectHandler" TValue="Bet"></GridEvents>
    <GridColumns>
        <GridColumn Field="@nameof(Bet.BetId)" HeaderText="ID"></GridColumn>
        <GridColumn Field="@nameof(Bet.Stake)" HeaderText="Stake"></GridColumn>
        <GridColumn Field="@nameof(Bet.TotalOdds)" HeaderText="Total Odds"></GridColumn>
        <GridColumn Field="@nameof(Bet.PotentialWin)" HeaderText="Potential Win" Format="C2"></GridColumn>
        <GridColumn Field="@nameof(Bet.BetDate)" Format="d" HeaderText="Bet Date" Type="ColumnType.Date"></GridColumn>
        <GridColumn Field="@nameof(Bet.Bookmaker)" HeaderText="Bookmaker"></GridColumn>
        <GridColumn Field="@nameof(Bet.Status)" HeaderText="Status"></GridColumn>
    </GridColumns>
</SfGrid>


<br />
<center>
    <div>
        Events for selected bet.
    </div>
</center>


<SfGrid DataSource="Events" Query="@(new Query().Where("BetId", "equal", RowIndex))">


</SfGrid>


@code {
    public IEnumerable<Bet> Bets { get; set; }
    public IEnumerable<Event> Events { get; set; }
    public Guid? RowIndex { get; set; }


    protected override async Task OnInitializedAsync()
    {
        Bets = await RepositoryWrapper.BetRepository.GetAllBetsAsync();
        Events = await RepositoryWrapper.EventRepository.GetAllEventsAsync();


    }
    public void RowSelectHandler(RowSelectEventArgs<Bet> Args)
    {
        RowIndex = Args.Data.BetId;
    }
}

and two related entities to this topic are:



public class Bet
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public Guid BetId { get; init; }


    public decimal TotalOdds { get; set; }


    public decimal Stake { get; set; }


    public DateTime BetDate { get; set; }


    public int Year { get; set; }
    public int Month { get; set; }
    public int DayOfWeek { get; set; }
    public string? Bookmaker { get; set; }
    public BetStatusEnum Status { get; set; } = BetStatusEnum.Unfinished;


    public bool IsTaxIncluded { get; set; } = true;


    public decimal PotentialWin
    {
        get
        {
            decimal win = Math.Round(Stake * TotalOdds);
            return IsTaxIncluded ? win * 0.86M : win;
        }
    }


    // Relationships


    public virtual ICollection<Event> EventsList { get; set; }
} and
public class Event
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public Guid EventId { get; init; }


    [Required]
    public double Odds { get; set; }




    public BetStatusEnum Status { get; set; } = BetStatusEnum.Unfinished;


    // Relationships
    public int CategoryId { get; set; }


    public virtual Category Category { get; set; }


    public int EventTypeId { get; set; }
    public virtual EventType EventType { get; set; }


    public Guid? BetId { get; set; }


    public virtual Bet Bet { get; set; }
}

 Is this something related to primary key being defined as Guid?


3 Replies 1 reply marked as answer

PS Prathap Senthil Syncfusion Team September 5, 2024 10:48 AM UTC

Hi Krzysztof Palonek,


We are unable to reproduce the reported issue when attempting to do so using the latest version 26.2.12. For your reference, we have attached a screenshot and a simple sample. So, to proceed with the reporting problem, we require some additional clarification from you. Please share the details below to proceed further at our end.


  • Could you please provide the NuGet version you are using?
  • You are using the Query property to filter values based on BetId, so if the value does not match, the second grid may show as empty. Could you please verify this on your end?
  • To help us analyze the reported issue, could you please share a simple and reproducible sample that demonstrates the problem? Alternatively, kindly share your attempts to replicate the issue using the attached sample

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


Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.

Regards,
Prathap Senthil



KP Krzysztof Palonek September 7, 2024 11:55 AM UTC

I've pinpointed the issue. I selected "None" in the Interactive render mode when creating the project. It must be set to a mode other than "None.



NP Naveen Palanivel Syncfusion Team September 8, 2024 06:37 AM UTC

Hi Krzysztof Palonek,

Based on the reported problem, it seems you are experiencing an issue with your .NET 8 project. To overcome the reported problem, please try the suggested changes below, Add the RenderMode.InteractiveServer option to your Razor pages to resolve the problem.

@page "/bets"

@using Domain.Contracts

@rendermode InteractiveServer


<BetsComponent></BetsComponent>


For more detailed insights, please visit the following blog and documentation.

Bloghttps://www.syncfusion.com/blogs/post/blazor-ui-support-dotnet-8.aspx
UG:
https://blazor.syncfusion.com/documentation/datagrid/getting-started-with-web-app

Documentationhttps://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0|


Regards,
Naveen


Attachment: BetPayRepositories_3a9ef8b5.zip

Marked as answer
Loader.
Up arrow icon