or
"<
div
class
=
"k-widget k-tabstrip k-header"
id
=
"Inty#=Id#"
><
ul
class
=
"k-reset k-tabstrip-items"
><
li
class
=
"k-item k-state-default"
><
a
class
=
"k-link"
href
=
"\#Inty#=Id#-1"
>Turtle</
a
></
li
></
ul
><
div
class
=
"k-content"
id
=
"Inty#=Id#-1"
>Brownie</
div
></
div
><
script
><
br
><
span
class
=
"Apple-tab-span"
style
=
"white-space:pre"
> </
span
>jQuery(function(){jQuery("\#Inty#=Id#").kendoTabStrip({});});<
br
><\/script>"
<
script
id
=
"jobGridTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().TabStrip().Name("Inty#=Id#").Items( items => items.Add().Text("Turtle").Content(@<
text
>Brownie</
text
>) ).ToClientTemplate())
</
script
>
@(
Html.Kendo().Grid<
JobGridViewModel
>()
.Name("Grid")
.ClientDetailTemplateId("jobGridTemplate")
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden();
columns.Bound(p => p.Name).Width("15em").ClientTemplate(Html.ActionLink("#=Name#", "Edit", new {selectedjobid = "#=Id#"}).ToHtmlString());
columns.Bound(p => p.Number).Width("11em");
columns.Bound(p => p.Cost).Width("12em");
columns.Bound(p => p.Status).Template(@<
text
>
@item.Status;
</
text
>)
.ClientTemplate("#= statusValues[Status] #")
.EditorTemplateName("JobStatusEditor").Width("9em");
columns.Bound(p => p.Date).Width(130).Format("{0:d}").EditorTemplateName("Date");
columns.Bound(p => p.Commissions).Filterable(false).Template(@<
text
>
@ListCommission(item, CommissionType.Sell)
</
text
>).EditorTemplateName("ClientCommission").ClientTemplate("#= template(data.Commissions) #").Sortable(false);
columns.Command(command =>
{
command.Edit();
command.Destroy();
command.Custom("Duplicate").Text("Copy").SendDataKeys(true).SendState(true).Click("onGridCommand");
}).Width(280);
}).ToolBar(y=> y.Template(
@<
text
>
<
div
>
Job Name
@(Html.Kendo().AutoComplete().Name("SearchName").DataSource(source =>
{
source.Read(read => read.Action("_GetJobNamesLike", "Jobs" })
.Events(events => events.Change("onFilterChange")))
</
div
>
<
div
>
Job Number
@(Html.Kendo().AutoComplete().Name("SearchNumber")
.DataSource(binding =>
{
binding.Read(read => read.Action("_GetJobNumbersLike", "Jobs"));
}).Events(events => events.Change("onFilterChange")))
</
div
>
@item.CustomCommandToolBarButton("NewJob", "New Job", "New", "Jobs", null)
</
text
>))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Sortable()
.Pageable(paging => paging.PageSizes(new int[]{20,40,60,80}))
.Scrollable(config => config.Height(1000).Virtual(true))
.Resizable(resize => resize.Columns(true))
.Filterable()
.DataSource( dataBinding =>
dataBinding.Ajax().Events(e =>
{
e.RequestStart("onGridDataBinding"); // try Ajax().Data("sendData") return { foo: "bar" };
}).Model(model => model.Id(id => id.Id))
.Read(read=>read.Action("_SelectAjaxEditing", "Jobs", new {jobName="", jobNumber=""}))
.Create(create => create.Action("_InsertAjaxEditing", "Jobs"))
.Update(update => update.Action("_SaveAjaxEditing", "Jobs"))
.Destroy(destroy=>destroy.Action("_DeleteAjaxEditing", "Jobs")))
.Events(events =>
{
events.Change("onGridEdit").DataBound("onRowDataBound")
.DetailExpand("onGridExpand")
.DetailCollapse("onGridCollapse");
})
)
I am eager to see this product in action but this small issue would be a show stopper for me for switching over the rest of my code base.
<
script
type
=
"text/x-kendo-tmpl"
id
=
"template"
>
<
div
class
=
"process-view"
>
<
div
class
=
"edit-buttons"
>
@(Html.ActionLink("Create New", "Process_Create", "Process",
new { id=${ProcessID} }))
</
div
>
<
dl
>
<
dt
>Code</
dt
>
<
dd
>${ProcessCode}</
dd
>
<
dt
>Name</
dt
>
<
dd
>${Name}</
dd
>
<
dt
>Description</
dt
>
<
dd
>${Description}</
dd
>
<
dt
>ID</
dt
>
<
dd
>${ProcessID}</
dd
>
</
dl
>
</
div
>
</
script
>
[Required(ErrorMessageResourceName = "ValeurRequise", ErrorMessageResourceType = typeof(GlobalesResources))]
public int NoFormation { get; set; }
@(Html.Kendo().Grid<
MesFormations.Models.Employe
>()
.Name("Grid")
.Columns(columns =>
{
columns.ForeignKey(p => p.NoFormation, (System.Collections.IEnumerable)ViewBag.Formations, "Numero", "Description").Title(@MesFormations.Views.Employe.Resources.Titre).Width(240);
columns.Bound(p => p.DateFormation).Width(90).Format("{0:yyyy-MM-dd}").HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Remarques).Width(230);
columns.Command(command => command.Destroy()).Width(110);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Sortable()
.Scrollable()
.Resizable(resizing => resizing.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Events(events => events.Change("onEdit"))
.Model(model => model.Id(p => p.NoFormationEmploye))
.Create("Editing_Create", "Employe", new { NoEmploye = Model.NoEmploye })
.Read("Editing_Read", "Employe", new { NoEmploye = Model.NoEmploye })
.Update("Editing_Update", "Employe")
.Destroy("Editing_Destroy", "Employe")
)
)
catch (Exception ex)
{
ModelState.AddModelError("Error", ex.Message);
return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet);
}
function error(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}