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?