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

Can't get selected (Parent)Row in Popup-Editing-Window

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 15 Sep 2017, 06:34 AM

Hello community!

I have a problem with my grid and the popup-editing feature.

In my popup there is another grid which needs the email address from the selected row from parent grid (to get the right data in the child grid).

I already tried the "grid.dataItem(grid.select())"-Function. But its return false.

Maybe I misunderstand the problem.

 

This is my Main-Grid:

@(Html.Kendo().Grid<NPHE2016Management.Models.MailboxViewModel>()
            .Name("mailboxes")
            .Columns(columns =>
            {
                columns.Bound(c => c.mailboxID).Hidden();
                columns.Bound(c => c.upn).Hidden();
                columns.Bound(c => c.mailboxType);
                columns.Bound(c => c.firstName);
                columns.Bound(c => c.lastName);
                columns.Bound(c => c.email);
                columns.Bound(c => c.mailboxSize).Title("Mailbox Größe (MB)");
                columns.Command(command => { command.Edit().Text(" "); command.Destroy().Text(" "); }).Width(150);
            })
            .ToolBar(toolbar => toolbar.Create())
            .HtmlAttributes(new { style = "height: 550px;" })
            .Scrollable()
            .Sortable()
            .Selectable(x => x.Mode(GridSelectionMode.Single))
            .Editable(editable => editable
                .Mode(GridEditMode.PopUp)
                .TemplateName("MailboxTemplate")
                .Window(window => window.Width(1000).HtmlAttributes(new { style = "width:700px;" }))
            )
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(p => p.mailboxID))
            .Read(read => read.Action("MailboxRead", "Home"))
            .Create(update => update.Action("MailboxCreate", "Home")).Events(ev => ev.Error("onErrorMailbox"))
            .Update(update => update.Action("MailboxUpdate", "Home")).Events(ev => ev.Error("onErrorMailbox"))
            .Destroy(update => update.Action("MailboxDelete", "Home")).Events(ev => ev.Error("onErrorMailbox"))
            .PageSize(20)            
        )
        .Events(e =>
        {
            e.Edit("onEdit");
            e.Remove("onRemove");
            e.Change("onRowChange");
        })
)

 

Thank you very much.

Best regards

Patrick

3 Answers, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 18 Sep 2017, 01:48 PM
Hello Patrick,

A possible solution to achieve the desired result is handling the edit event (based on the provided code, you are already doing that). In the event handler get the data item(e.model). 
Please, give it a try and let me know if it works for you.


Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Alex
Top achievements
Rank 1
answered on 15 Aug 2018, 06:19 PM
This link is broken. Has it been moved to a new location?
0
Preslav
Telerik team
answered on 16 Aug 2018, 07:36 AM
Hello Alex,

Indeed, the edit event handler API reference moved to: 

Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Alex
Top achievements
Rank 1
Share this question
or