I have the following grid:
@(Html.EJ().Grid<SlimHub.Models.WorkActivity>("ActivitiesGrid")
.Datasource(ds => ds.Json((IEnumerable<WorkActivity>)Model.WorkActivities.ToList()).UpdateURL("../NormalActivityUpdate").InsertURL("../NormalActivityInsert").RemoveURL("../NormalActivityDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EditSettings(edit =>
{
edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#ActivityTemplate");
})
.Locale("it-IT")
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.AllowResizing()
.AllowTextWrap(true)
.Columns(col =>
{
col.Field("Id").HeaderText("ID Attività").HeaderTextAlign(TextAlign.Center).IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(5).Visible(false).Add();
col.Field("WorkId").DefaultValue(@Model.WorkId).HeaderText("ID Lavoro").HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Right).Width(5).Visible(false).Add();
col.Field("OperatorId").HeaderText("Operatore").ForeignKeyField("OperatorId").ForeignKeyValue("OperatorDesc").DataSource((IEnumerable<object>)ViewBag.Operators).HeaderTextAlign(TextAlign.Center).Width(10).Add();
col.Field("Subject").HeaderText("Attività").HeaderTextAlign(TextAlign.Center).Width(30).Add();
col.Field("Description").HeaderText("Attività").HeaderTextAlign(TextAlign.Center).Width(30).Add();
col.Field("AllDay").DefaultValue(0).HeaderText("Attività").HeaderTextAlign(TextAlign.Center).Visible(false).Add();
col.Field("Recurrence").DefaultValue(0).HeaderText("Attività").HeaderTextAlign(TextAlign.Center).Visible(false).Add();
})
.ClientSideEvents(eve =>
{
eve.ActionComplete("ActivitiesGridActionComplete");
eve.ActionBegin("ActivitiesGridActionBegin");
eve.EndEdit("endEdit");
eve.EndAdd("endAdd");
eve.BeginEdit("ActivitiesGridBeginEdit");
})
)
The custom dialog form is this:
<script id="ActivityTemplate" type="text/template">
<div>
<b>Dettagli Attività</b>
<table cellspacing="10">
<tr>
<td style="text-align: right;">
ID Attività
</td>
<td style="text-align: left">
<input id="Id" name="Id" value="{{: Id}}" disabled="disabled" class="e-field e-ejinputtext valid e-disable"
style="text-align: right; width: 300px; height: 28px" />
</td>
<td style="text-align: right;">
ID Lavoro
</td>
<td style="text-align: left">
<input id="WorkId" name="WorkId" value="{{: WorkId}}" disabled="disabled" class="e-field e-ejinputtext valid e-disable"
style="width: 300px; height: 28px" />
</td>
</tr>
<tr>
<td style="text-align: right;">
Oggetto
</td>
<td style="text-align: left">
<input id="Subject" name="Subject" value="{{: Subject}}" class="e-field e-ejinputtext valid"
style="text-align: right; width: 300px; height: 28px" />
</td>
<td style="text-align: right;">
Descrizione
</td>
<td style="text-align: left">
<textarea id="Description" name="Description" class="e-field e-ejinputtext valid"
style="width: 300px; height: 28px" >{{: Description}}</textarea>
</td>
</tr>
<tr>
<td style="text-align: right;">
Ora Inizio
</td>
<td style="text-align: left; width: 300px;">
<input id="StartTime" name="StartTime" value="{{: StartTime}}" style="width: 300px; height: 28px" />
</td>
</tr>
<tr>
<td style="text-align: right;">
TimeZone Ora Inizio
</td>
<td style="text-align: left; width: 300px;">
<input id="StartTimeZone" name="StartTimeZone" value="{{: StartTimeZone}}" style="width: 300px; height: 28px" />
</td>
<td style="text-align: right;">
TimeZone Ora Fine
</td>
<td style="text-align: left; width: 300px;">
<input id="EndTimeZone" name="EndTimeZone" value="{{: EndTimeZone}}" style="width: 300px; height: 28px" />
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function ActivitiesGridActionBegin(args) {
if (args.requestType == "save")
this._isEditChangesApplied = true;
}
function ActivitiesGridActionComplete(args) {
if (args.requestType == "beginedit" || args.requestType == "add") {
$("#StartTime").ejDateTimePicker({ locale: "it-IT", width: "300", dateTimeFormat: "dd/MM/yyyy HH:mm:ss" });
$("#StartTimeZone").val('@(SlimHub.Properties.Settings.Default.TimeZone)');
$("#EndTimeZone").val('@(SlimHub.Properties.Settings.Default.TimeZone)');
}
}
</script>
I have included culture specific js file:
When I select the date from DateTime Picker and try to Save, I got the following error:
ej.web.all.min.js:10 Uncaught TypeError: Cannot read property 'format' of null
Can you help me?
Thanks.
Claudio