Question about RadzenDataGridColumn IsInEditMode

Greetings, I have a question about the behaviour of IsInEditMode

Context
In Radzen 4 I could set which columns I wanted EditTemplate to render by the use of IsInEditMode

I have recently updated to Radzen 6 and I've noticed the columns are not set in edit mode anymore. After some experimentation I've discovered that since Radzen 5 this flag does not seem to work as expected anymore (Template always render)

Questions
Has this behaviour intentionally changed?
If so, for my desired use case, how could I set the cells of a column to render EditTemplate

Here's the test code I've tested in radzen 4 vs radzen 5. In the former I see cells are in EditTemplate in the later they always render Template

@page "/TestingPage"
@rendermode @(new InteractiveServerRenderMode(false))
<RadzenDataGrid TItem="Order"
                Data="@_orders"
                ColumnWidth="200px">
    <Columns>
        <RadzenDataGridColumn TItem="Order" Property="@nameof(Order.ShipName)" Title="Ship Name"
                              IsInEditMode="IsEditing">
            <Template Context="order">
                <RadzenText Text="@(order.ShipName)"/>
            </Template>
            <EditTemplate Context="order">
                <RadzenTextBox @bind-Value="order.ShipName"
                               Style="width:200px; display: block" Name="ShipName" aria-label="Enter ship name"/>
            </EditTemplate>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

@code {
    readonly List<Order> _orders = [];

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        // Generate sample data
        _orders.AddRange([
            new Order
            {
                ShipName = "Ship 1",
            },
            new Order
            {
                ShipName = "Ship 2",
            }
        ]);
    }

    static bool IsEditing(string columnName, Order order)
    {
        return true;
    }

}

@code{
    public class Order
    {
        public string? ShipName { get; set; }
    }
}

In my opinion this worked incidentally since we didn’t made any changes in our editing demos between these versions and they still work normally:

Hello

Thanks for your response

In the demos you share, the behaviour is not quite what I described since the editing is only finally enabled by grid.EditRow rather than by IsInEditMode itself

What I expect is for the whole cells that belong to a column to be in edit mode from the getgo, merely from IsInEditMode, as it so happened in Radzen 4.

By "this worked incidentally" do you mean that in radzen 4 this was not an intended behaviour and it was "fixed"?

Yes, that's what I've noted.

I see, do you have any suggestions as to how I could implement what I'm looking for? So far I've dropped EditTemplate and I'm using an @if with the edit condition inside the Template itself

There is no validation when you use Template. This thread might be helpful:

I don't actually need Validation. Are there any other issues you think I could experience if I leave it inside the Template with an if as I mentioned?

I cannot think of any other.

1 Like

Thanks, issue closed then