I am trying to get the Shield UI Grid control to have a DateTimePicker in edit mode.
I have been able to add it to the view mode, but it is not persisted when you click edit for the row.
Additionally, the DateTimePicker is not correctly rendering the date in Australian format.
Here is my code. I have taken out the modifyObject code reduce the code spam.
@(Html.ShieldGrid()
.Name("grid")
.DataSource(ds => ds.Remote(rb => rb.Read("/Tours/getVouchers/94")
.Schema(sb => sb
.Fields("TourItineraryVoucherId", fb => fb.Path("TourItineraryVoucherId").Type(Shield.Mvc.UI.DataSource.FieldType.Number))
.Fields("Name", fb => fb.Path("Name").Type(Shield.Mvc.UI.DataSource.FieldType.String))
.Fields("StartTime", fb => fb.Path("StartTime").Type(Shield.Mvc.UI.DataSource.FieldType.Date))
.Fields("EndTime", fb => fb.Path("EndTime").Type(Shield.Mvc.UI.DataSource.FieldType.Date))
.Fields("TransportType", fb => fb.Path("TransportType").Type(Shield.Mvc.UI.DataSource.FieldType.String))))
.PagingConfiguration(pb => pb.PageSize(30))
.RowHover(false)
.Columns(cb => cb
.Field("Name")
.Title("Name"))
.Columns(cb => cb
.Field("StartTime")
.Title("Pickup")
.Format("{0:dd/MM/yyyy h:MM tt}")
.ColumnTemplate(@<text>function columnTemplate(cell, item) { $('<input />').appendTo(cell).shieldDateTimePicker({value: new Date(item["StartTime"]), format: "{0:dd/MM/yyyy h:MM tt"}); }</text>))
.Columns(cb => cb
.Field("EndTime")
.Title("Dropoff")
.Format("{0:dd/MM/yyyy h:MM tt}"))
.Columns(cb => cb
.Field("TransportType")
.Title("Type")
.Width(70))
.Columns(cb => cb
.Width(150)
.Title(" ")
.Buttons(b => b.CommandName("edit").Caption("Edit"))
.Buttons(b => b.CommandName("delete").Caption("Delete")))
.Editing(eb => eb
.Enabled(true)
.Type(Shield.Mvc.UI.Grid.EditingTypeOptions.Row)
.Confirmation(c => c
.Delete(d => d
.Enabled(true)
.Template(@<text>
function (item) {
return "Delete Voucher - '" + item.Name + "'?";
}
</text>))))
.ToolBar(tb => tb
.Buttons(b => b.CommandName("insert").Caption("Add Product"))
.Position(Shield.Mvc.UI.Grid.PositionOptions.Top))
)