This is a migrated thread and some comments may be shown as answers.

Save row on leaving row focus

2 Answers 332 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andre Broers
Top achievements
Rank 1
Andre Broers asked on 17 Feb 2012, 03:00 PM
I have a hierarchical grid but i first have to save the parent before adding child records. But you can open the child view even if the parent isn't saved yet. Does anyone has a solution? Catch an onrowleft event or something?

Thanx

2 Answers, 1 is accepted

Sort by
0
Brian
Top achievements
Rank 1
answered on 26 Feb 2013, 09:25 AM
Was wondering if you'd figured this out. It was something we could easily do in silverlight. 
0
Vladimir Iliev
Telerik team
answered on 01 Mar 2013, 08:41 AM
Hi Andre,

 
To be able to achieve the desired behavior you can for example attach delegate on the click event of the detail expand arrow to check if current parent dataItem is new (is not saved) to prevent the expanding of the detail grid. Please check the example below:

//Change Employees with your grid name
//the grid should have model ID defined
$("#Employees table").on("click", ".k-hierarchy-cell a", function (e) {
    dataItem = $("#Employees").data("kendoGrid").dataItem($(e.srcElement).closest("tr"));
    //check if is new record
    if (dataItem.isNew()) {
        e.preventDefault();
        e.stopImmediatePropagation();
    }
})

 
Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Andre Broers
Top achievements
Rank 1
Answers by
Brian
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or