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

Click on "canceledit" opens deleteConfirm-Dialog

1 Answer 50 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 06 Jun 2017, 02:59 PM

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?

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 08 Jun 2017, 02:01 PM
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.
Tags
TreeList
Asked by
Oliver
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or