Hi team !
I'm trying to work with the inline edit mode, but I can't manage to call my controller's method when a value is changed.
My grid is diplayed correctly, and I can click on the edit button, that makes the update and cancel button appear. Cancel works fine, but Update doesn't. In fact, both buttons are doing the exact same thing : making me leave edit mode.
.Update(update => update.Action("EditingInline_Update", "PeriodesRecueil"))
I hoped this line to call my "EditingInline_Update" method in my "PeriodesRecueil" controller, but it doesn't.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, PeriodeRecueilViewModel prVm)
{
return Json(new { });
}
Here is my html
@model List<
PeriodeRecueilViewModel
>
@(Html.Kendo().Grid(Model)
.Name("gridHistoPeriodesRecueil")
.NoRecords("Aucune période de récueil n'a été trouvée.")
.Columns(columns =>
{
columns.Bound(l => l.dateDebut)
.Title("Date de début")
.Width(300)
.ClientTemplate("<
div
class=#:hasErrorDateDebut?'orangeBack':''#>" +
"<
div
class=#:isActive?'greenBack':''#>" +
" #=kendo.toString(dateDebut,'dd / MM / yyyy')# " +
"</
div
>" +
"</
div
>")
.HeaderHtmlAttributes(new { style = "text-align:center;" })
.Filterable(filterable => filterable
.Extra(false)
.Messages(m => m.Info("Afficher les lignes dont la date..."))
.Operators(operators => operators
.ForDate(dt => dt.Clear()
.IsEqualTo("est...")
.IsGreaterThanOrEqualTo("est ultérieure à...")
.IsLessThanOrEqualTo("est antérieure à...")))
)
.EditorTemplateName("Date");
columns.Bound(l => l.dateFin)
.Title("Date de fin")
.Width(300)
.ClientTemplate("<
div
class=#:hasErrorDateFin?'orangeBack':''#> " +
"#=kendo.toString(dateFin,'dd / MM / yyyy')# " +
"</
div
>")
.HeaderHtmlAttributes(new { style = "text-align:center;" })
.Filterable(filterable => filterable
.Extra(false)
.Messages(m => m.Info("Afficher les lignes dont la date..."))
.Operators(operators => operators
.ForDate(dt => dt.Clear()
.IsEqualTo("est...")
.IsGreaterThanOrEqualTo("est ultérieure à...")
.IsLessThanOrEqualTo("est antérieure à...")))
)
.EditorTemplateName("Date");
columns.Template(@<
text
></
text
>)
.Title("États")
.Width(125)
.ClientTemplate("# if(hasErrorDateDebut || hasErrorDateFin) {# <
div
class
=
'k-icon k-i-warning'
></
div
> #} # " +
"# if(isActive) {# <
div
class
=
'k-icon k-i-doughnut'
></
div
> #} # " +
"# if(hasHappened) {# <
div
class
=
'k-icon k-i-clock'
></
div
> #} #")
.HeaderHtmlAttributes(new { style = "text-align:center;" });
columns.Command(command =>
{
command.Edit().Text(" ").IconClass("k-icon k-i-edit").Visible("hasNotHappened").UpdateText(" ").CancelText(" ");
command.Custom("cmdAnnuler").Text(" ").Click("cmdAnnuler").IconClass("k-icon k-i-close").Visible("hasNotHappenedAndNotToday");
})
.Title("Actions")
.Width(125)
.HeaderHtmlAttributes(new { style = "text-align:center" })
.HtmlAttributes(new { @class = "actions" });
})
.Events(events => events
.DataBound("onDataBound"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.HtmlAttributes(new { style = "text-align:center" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(l => l.idPeriodePaie))
.Update(update => update.Action("EditingInline_Update", "PeriodesRecueil"))
.ServerOperation(false)
.PageSize(10))
.Pageable()
.Filterable()
)
No error in the console. Any idea of what I'm doing wrong ?
Thank you,
Valentin