Hello,
I am newbie in telerik kendo UI. I start with list view and I don't have a clue how to pass some data during item creation. My scenario: I have some Types. Each type has some groups. For each typeI want to create List View with some groups. I used sample List View editing and have some questions:
- where Can I find information about different types of client template. I mean this markups because in samples there is only string display, and convert to string with some format
- how can I pass TypeID during Item Creation
My editor template code:
My Type ID is always 0. When I am editing group Type ID is populated.
List View:
I am newbie in telerik kendo UI. I start with list view and I don't have a clue how to pass some data during item creation. My scenario: I have some Types. Each type has some groups. For each typeI want to create List View with some groups. I used sample List View editing and have some questions:
- where Can I find information about different types of client template. I mean this markups because in samples there is only string display, and convert to string with some format
- how can I pass TypeID during Item Creation
My editor template code:
@model CustomFieldsGroup
@using (Html.BeginForm())
{
@Html.HiddenFor(x => x.GroupID)
@Html.HiddenFor(x => x.TypeID)
<
ul
>
<
li
>
@Html.LabelFor(x => x.GroupName)
</
li
>
<
li
>
@Html.EditorFor(x => x.GroupName)
</
li
>
</
ul
>
<
div
class
=
"edit-buttons"
>
<
a
class
=
"k-button k-button-icontext k-update-button"
href
=
"\\#"
><
span
class
=
"k-icon k-update"
></
span
>Save</
a
>
<
a
class
=
"k-button k-button-icontext k-cancel-button"
href
=
"\\#"
><
span
class
=
"k-icon k-cancel"
></
span
>Cancel</
a
>
</
div
>
}
List View:
<
div
class
=
"k-toolbar k-grid-toolbar"
>
<
a
id
=
"addRoleButton"
class
=
"k-button k-button-icontext k-add-button test"
href
=
"\\#"
><
span
class
=
"k-icon k-add"
></
span
>Add new group</
a
>
</
div
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"customFieldTemplate"
>
<
div
class
=
"product-view k-widget"
>
<
div
class
=
"edit-buttons"
>
<
a
class
=
"k-button k-button-icontext k-edit-button"
href
=
"\\#"
><
span
class
=
"k-icon k-edit"
></
span
></
a
>
<
a
class
=
"k-button k-button-icontext k-delete-button"
href
=
"\\#"
><
span
class
=
"k-icon k-delete"
></
span
></
a
>
</
div
>
<
div
>
Group Name
</
div
>
<
div
>
${GroupName}
</
div
>
@*<
dl
>
<
dt
>GroupName</
dt
>
<
dd
>${GroupName}</
dd
>
<
dt
>Unit Price</
dt
>
<
dd
>#:kendo.toString(UnitPrice, "c")#</
dd
>
<
dt
>Units In Stock</
dt
>
<
dd
>#:UnitsInStock#</
dd
>
<
dt
>Discontinued</
dt
>
<
dd
>#:Discontinued#</
dd
>
</
dl
>*@
</
div
>
</
script
>
<
div
class
=
"fields"
>
@(Html.Kendo().ListView<
CustomFieldsGroup
>(Model.Groups)
.Name("listView")
.ClientTemplateId("customFieldTemplate")
.TagName("div")
.DataSource(datasource =>
datasource.Model(model=>
{
model.Id(x => x.GroupID);
model.Field(x => x.TypeID).Editable(false);
model.Field(x => x.GroupName);
})
.Read(ac => ac.Action("Index_Read", "CustomFields"))
.Create(ac => ac.Action("CreateGroup", "CustomFields"))
.Update(ac => ac.Action("EditGroup", "CustomFields")))
.Editable())
)
</
div
>
<
script
>
$(function () {
var listView = $("#listView").data("kendoListView");
$(".test").bind("click", function (e) {
listView.add();
e.preventDefault();
})
})
</
script
>