Completed
Last Updated: 15 Feb 2022 20:37 by ADMIN
Release 3.1.0
Jack
Created on: 30 Nov 2020 13:48
Category: TreeList
Type: Feature Request
8
OnRowClick and OnRowDoubleClick event
Need an OnRowDoubleClick event for editing purposes.
5 comments
ADMIN
Nadezhda Tacheva
Posted on: 21 Oct 2021 15:43

Hello Benjamin,

We discussed the TreeList OnRowDoubleClick feature with the Product Manager and as we see growing demand for it, we will prioritize it in our next product planning. We will change the feedback label with the respective release in which it will be included.

In addition, I tweaked the title a bit to also cover the OnRowClick click event in regards to a request that was separately created for it.

Regards,
Nadezhda Tacheva
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Benjamin
Posted on: 18 Oct 2021 09:12

Hello Telerik-Team,

is there any chance to get an update on this? It's not over 1 year in the "unplanned" bucket and I'd like to second, that it will be very useful.

 

Regards

ADMIN
Nadezhda Tacheva
Posted on: 09 Dec 2020 11:37

Hi Jack,

Apologies for the misunderstanding as I assumed your request was regarding the Grid.

Speaking of the TreeList, OnRowDoubleClick event is a valid feature request and I also consider it very useful for various cases to implement. 

This is why I tweaked the title to represent OnRowDoubleClick event in general (not only for editing purposes as it can be applied in multiple scenarios). I have also changed the status to "Unplanned". 

In case you haven't followed the OnRowDoubleClick event public post, you can go ahead and do so in order to be notified via email on status changes (this is the best way to know when/if a feature gets implemented. If we have it planned for a certain release, we add that information in the public feedback portal).

Regards,
Nadezhda
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Jack
Posted on: 04 Dec 2020 21:18

Hi Nadezhda,

 

Is it possible to add this feature to the TreeList component? We have a page that's using this component instead of the grid, but would still like the double click to edit.

 

Thanks,

 

Jack

ADMIN
Nadezhda Tacheva
Posted on: 03 Dec 2020 17:09

Hi Jack,

The Grid currently has an OnRowDoubleClick  event and you can find more information about it here.

In the meantime, to illustrate its behavior when it comes to editing, I have created a small example, please see below

 

@*Use the OnRowDoubleClick event to set a row in edit mode*@ 

<TelerikGrid Data="@MyData"
             Height="400px"
             Pageable="true"
             OnRowDoubleClick="@OnRowDoubleClickHandler"
             EditMode="@GridEditMode.Inline"
             OnUpdate="@UpdateHandler"
             @ref="@GridRef">
    <GridColumns>
        <GridColumn Field="@(nameof(SampleData.Id))" Editable="false" Width="120px" />
        <GridColumn Field="@(nameof(SampleData.Name))" Title="Employee Name" />
        <GridColumn Field="@(nameof(SampleData.Team))" Title="Team" />
        <GridCommandColumn>
            <GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Update</GridCommandButton>
            <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
            <GridCommandButton Command="Delete" Icon="delete">Delete</GridCommandButton>
            <GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
        </GridCommandColumn>
    </GridColumns>
</TelerikGrid>


@code {  

    public TelerikGrid<SampleData> GridRef { get; set; }

    void UpdateHandler(GridCommandEventArgs args)
    {
        SampleData itemToUpdate = args.Item as SampleData;
        int itemIndex = MyData.IndexOf(itemToUpdate);
        if (itemIndex > -1)
        {
            MyData[itemIndex] = itemToUpdate;
        }
    }

    void OnRowDoubleClickHandler(GridRowClickEventArgs args)
    {
        var updatedItem = args.Item as SampleData;
        EditItem(updatedItem);
    }

    void EditItem(SampleData item)
    {
        var currState = GridRef.GetState();
        currState.InsertedItem = null;
        currState.EditItem = null;
        currState.OriginalEditItem = null;
       
        SampleData itemToEdit = SampleData.GetClonedInstance(MyData.FirstOrDefault(x => x.Id == item.Id));
        
        currState.OriginalEditItem = itemToEdit;
        GridRef.SetState(currState);
    }

    public List<SampleData> MyData = Enumerable.Range(1, 30).Select(x => new SampleData
    {
        Id = x,
        Name = "name " + x,
        Team = "team " + x % 5,
    }).ToList();

    public class SampleData
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }

        public override bool Equals(object obj)
        {
            if (obj is SampleData)
            {
                return this.Id == (obj as SampleData).Id;
            }
            return false;
        }

        public SampleData()
        {

        }

        public SampleData(SampleData itmToClone)
        {
            this.Id = itmToClone.Id;
            this.Name = itmToClone.Name;
            Team = itmToClone.Team;
        }

        public static SampleData GetClonedInstance(SampleData itmToClone)
        {
            return new SampleData(itmToClone);
        }
    }
}

 

*Note: When you are programmatically setting a row in edit mode through the Grid state, you should perform all the tasks synchronously.

At this stage the asynchronous calls in Grid events prevent you from updating the Grid state. It is a known behavior, we have it logged in the public portal at the following link.

I have added a vote to it on your behalf to increase its priority. You can also follow it to receive email notification on status changes. This is the best way to find out when it is in production, when we plan it for a certain release, we add that information to the Feedback Portal Page.

In the meantime, I have marked this post's status as "Completed" since OnRowDoubleClick event for editing is actually an existing feature.

Regards,
Nadezhda
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.