or
// Create an observable view model object.
var
person = kendo.observable({
firstName:
"John"
,
lastName:
"DeVight"
,
// Create a dependent method (calculated field).
fullName:
function
() {
// The "get" function must be used so that changes to any
// dependencies will be reflected in the dependent method.
return
this
.get(
"firstName"
) +
" "
+
this
.get(
"lastName"
);
}
});
// Bind the view model to the personFields element.
kendo.bind($(
'#personFields'
), person);
// This produces the function() without handing off the value to the JS variable
var
fullName = person.get(
"fullName"
);
// Create an observable view model object.
var
person = kendo.observable({
firstName:
"John"
,
lastName:
"DeVight"
,
// Create a dependent method (calculated field).
fullName:
function
() {
// The "get" function must be used so that changes to any
// dependencies will be reflected in the dependent method.
return
person.get(
"firstName"
) +
" "
+ person.get(
"lastName"
);
}
});
// Bind the view model to the personFields element.
kendo.bind($(
'#personFields'
), person);
var
fullName = person.get(
"fullName"
);
var
ViewModel;
// Create an observable view model object.
var
person =
function
() {
var
self =
this
;
self.firstName = ko.observable(
"John"
);
self.lastName = ko.observable(
"DeVight"
);
// Create a dependent method (calculated field).
self.fullName = ko.computed(
function
() {
return
self.firstName() +
" "
+ self.lastName();
});
};
// Match to the global JS object
ViewModel =
new
person();
// Bind the view model to the personFields element.
ko.applyBindings(ViewModel, document.getElementById(
"result"
));
var
fullName = ViewModel.fullName();
$(
"#result"
).html(fullName);
{
field:
"Role"
,
title:
"ruolo"
,
template :
"<span>${Role.Name}</span>"
,
filterable: {
ui: RoleFilter,
extra:
false
},
editor:
function
(container, object) {
SetRoleSelect(container, object);
}
},
fields: {
prop1 : {type:
"string"
}
Role: {
Id: { type:
"int"
, editable:
false
},
Name: { type:
"string"
, editable:
true
, validation: { required:
true
} },
Descrizione: { type:
"string"
, editable:
true
, validation: { required:
false
} },
Visible: { type:
"boolean"
, editable:
true
},
Rango: { type:
"number"
, editable:
true
, validation: { required:
true
, min: 0 } }
}
RoleFilter:
function
(element) {
element.kendoDropDownList({
dataTextField:
"Name"
,
dataValueField:
"Id"
,
dataSource: {
transport: {
read: {
url:
"my url returning a list of Role object"
,
cache:
true
}
}
},
optionLabel:
"Select a Role"
});
}
@(Html.Kendo().Window() .Name("window") .Title("Role") .Content("loading...") .LoadContentFrom("Create", "RolesPermissions", Model.Role) .Modal(true) .Width(550) .Height(300) .Visible(false) )
$(document).ready(function () { var wnd = $("#window").data("kendoWindow"); wnd.bind("refresh", function (e) { var win = this; $("#close").click(function() { win.close(); }); }); $("#open").click(function (e) { wnd.center(); wnd.open(); }); });
[HttpPost] public ActionResult Create(RoleModel model) { if (ModelState.IsValid) { RoleDto role = new RoleDto { Name = model.Name, Description = model.Description }; var roleAdded = _rolePermissionsRepository.AddRole(role); if (roleAdded != null) { //CLOSE KENDOUI WINDOW } else { //PRINT ERROR MSG TO KENDOUI WINDOW } } return View(); }
<
link
href
=
"@Url.Content("
~/Content/kendo.compatibility.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/kendo.dataviz.default.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/kendo.common.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/kendo.dataviz.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
@*<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/kendo.default.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>*@
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/kendo.dataviz.default.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.918/WFHCustom/KendoCustomTheme.css")
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.918/kendo.all.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo.modernizr.custom.js")"></
script
>