Click on "canceledit" opens deleteConfirm-Dialog

2 posts, 0 answers
  1. Oliver
    Oliver avatar
    1 posts
    Member since:
    Apr 2017

    Posted 06 Jun Link to this post

    I included the TreeList-Component in my view like this:

     

    @(Html.Kendo().TreeList<TaxonomyTreeNodeViewModel>()
                  .Name("treelist")
                  .Toolbar(
                      toolbar =>
                      {
                          /*toolbar init*/
                      }
                  )
                  .Columns(columns =>
                  {
                      columns.Add().Field(e => e.GermanTranslation);
                      columns.Add().Field(e => e.Sequence);
                      columns.Add().Command(c =>
                      {
                          if (!Model.IsPublished)
                              c.Edit();
                          if (!Model.IsPublished)
                              c.Destroy();
                          if (!Model.IsPublished)
                              c.CreateChild();
                      });
                  })
                  .Editable(editable => editable.Move(true))
                  .Reorderable(true)
                  .Filterable()
                  .Sortable()
                  .Editable()
                  .DataSource(dataSource => dataSource
                      .Read(read => read.Action("All", "DashboardTaxonomy"))
                      .Update(update => update.Action("Update", "DashboardTaxonomy"))
                      .Create(create => create.Action("Create", "DashboardTaxonomy"))
                      .Destroy(destroy => destroy.Action("Destroy", "DashboardTaxonomy"))
                      .ServerOperation(false)
                      .Model(m =>
                      {
                          m.Id(f => f.Id);
                          m.ParentId(f => f.ParentId);
                          m.Field(f => f.EnglishTranslation);
                          m.Field(f => f.Sequence);
     
                      })
                  )
                  .Events(
                      events =>
                          {
                              events.DataBound("TaxonomyTreeWidget.dataBound");
                          }
                  )
                  )
        }

     

    With the following Model:

        public class TaxonomyTreeNodeViewModel
        {
            public string Id { get; set; }
            public string ParentId { get; set; }
            [Display(Name = "Reihenfolge")]
            public int Sequence { get; set; }
            [Display(Name = "Deutsche Bezeichnung")]
            public string GermanTranslation { get; set; }
            [Display(Name = "Englische Bezeichnung")]
            public string EnglishTranslation { get; set; }
            [Display(Name = "Versionsnummer")]
            public int Version { get; set; }
            [Display(Name = "Veröffentlicht")]
            public bool Published { get; set; }
           /*[...]*/
    }

     

    The TreeListrenders the expected result. When I click on an edit-button I'm able to edit and save the data-row. 

    But when I cancel the Edit a Confirm Dialog appears (Test: "Are you sure you want to delete this record?") and the button with data-command="canceledit" is deleted from the DOM and a data-command="destroy"-Button appears.

    I found these issues with almost the same behavior: 

    http://www.telerik.com/forums/grid-popup-edit-cancel-problem

    http://www.telerik.com/forums/bug---cancel-button-in-event-edit-window-is-removing-event

    Can you help me?

  2. Georgi
    Admin
    Georgi avatar
    160 posts

    Posted 08 Jun Link to this post

    Hello Oliver,

    I examined your code and I wasn't able to recreate your issue. Your configuration works as expected on my end.

    The described behaviour occurs when the Id of the model is missing or have a default value. Because clicking the cancel button reverts all the changes. So if you cancel the changes of data item without Id, basically the grid threats the data as newly created and removes it.

    In case this  does not help, I would like to ask you to send us a sample isolated project where the issue occurs, so we can investigate locally your exact scenario and help you more efficiently.


    Regards,
    Georgi
    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.
Back to Top