Razen Dynamic Grid settings not working on Production Env

Hello!

I have the following issue with the Radzen Data Grid.
I have created the following Dynamic Radzen Data Grid component to re-use in my application:

<RadzenDataGrid Data="@Data"
                TItem="IDictionary<string, string>"
                ColumnWidth="100px"
                AllowColumnResize="true"
                Style="width: calc(100vw - 380px)"
                EmptyText="@emptyText"
                AllowPaging="true"
                IsLoading="@IsLoading">
    <Columns>
        @foreach (var column in Columns)
        {
            <RadzenDataGridColumn TItem="IDictionary<string, string>" Title="@column.Key" Type="column.Value" Property="@GetColumnPropertyExpression(column.Key, column.Value)">
                <Template>
                    @context[@column.Key]
                </Template>
            </RadzenDataGridColumn>
        }
    </Columns>
</RadzenDataGrid>
public partial class DynamicTable
{
    const string emptyText = "No records found!";

    [Parameter]
    public IEnumerable<IDictionary<string, string>> Data { get; set; }

    [Parameter]
    public IDictionary<string, System.Type> Columns { get; set; }

    [Parameter]
    public bool IsLoading { get; set; }

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
    }

    public string GetColumnPropertyExpression(string name, System.Type type)
    {
        var expression = $@"it[""{name}""].ToString()";

        if (type == typeof(int))
        {
            return $"int.Parse({expression})";
        }
        else if (type == typeof(DateTime))
        {
            return $"DateTime.Parse({expression})";
        }

        return expression;
    }
}

Usage:

I have issues with the EmptyText and IsLoading properties meaning that they completely don't work on my Production Env. The production env means that the Blazor web app is hosted on a K8S Pod in Azure.

My scenario is the following:

  • I am clicking a button to start the process of generating some data;

  • First thing I do in the page where I am using this component is to set the variable that goes into the IsLoading to true. Also, I am generating an empty list of columns and data and pass them to the Component. This component is also surrounded by an if statement that controls the visibility of the grid. When clicking the button I am also settings that flag to true to allow the rendering of the component. This works fine on localhost, meaning that an empty table will appear with the loading marker:

  • If the data is generated, I then set the loading flag to false and pass the generated data to the table. No issues here, the table will be re-rendered with the new columns and rows.

  • If no data is generated, I then pass and empty enumerable which allows the table to use the EmptyText property and display a text. On localhost, this works fine:

On the prod env, the loading phase is ignored completely, meaning no empty table with a loading marker is generated, and if no results come back I am only displaying a thin line:

Hi @VladPaun,

Unfortunately I don't know what could be causing this behavior. Such a thin line could be rendered if the grid is totally empty - no data and no columns. Perhaps there is some exception - check your production logs for that.

Hey @korchev ,

Thank you for the quick answer, unfortunately, there are no Exceptions :frowning:

But I have 1 more piece of info, maybe it helps.

I also have other radzen data grids in other pages as well, those work fine.

The difference is that those radzen data grids are coded directly in that page, they are normal Data Grids, with a predefined number of columns, etc and are not using this Dynamic Grid component that I have written.

So I am only experiencing this behavior with this Grid that I have placed into a component to be re-used.

Also, if no data and no column are returned, shouldn't the EmptyText property kick in and display the message that I have set? Because that works fine on localhost, i am passing a

  • Enumerable.Empty<IDictionary<string, string>>() - for Data

  • new Dictionary<string, Type>() - for columns

And I get the text which i set for the EmptyText property displayed.

Also, don't forget about the IsLoading property not reacting at all on Prod env...

I am sorry but I don't know what could be causing this problem. Try inspecting the output HTML with the browser's developer tools. Maybe it would reveal something.