or
@(Html.Kendo().Grid<
MyViewModel
>()
.Name("importersGrid")
.Columns(columns =>
{
columns.Bound(m => m.Status).ClientTemplate("#=StatusText#").Filterable(filterable => filterable.UI("statusFilter");
columns.Bound(m => m.ActionOn).Format("{0:MMM dd, yyyy HH:mm}");
columns.Bound(m => m.Name).Title("Organization Name").ClientTemplate(@"# if (Status != 1) {# <
a
href
=
""
Organizations/Show?id=#=PublicId#"">#=Name#</
a
> #} else {# <
a
href
=
""
Importers/ApproveReject?id=#=PublicId#"">#=Name#</
a
>#}#");
columns.Bound(m => m.OrganizationCode);
columns.Bound(m => m.PrimaryLocation.City).Sortable(false);
columns.Bound(m => m.PrimaryLocation.Country).Sortable(false);
columns.Bound(m => m.PublicId).Sortable(false).Title("Actions").ClientTemplate(@"# if (Status==1) { #<
a
href
=
""
Organizations/ApproveReject?id=#=PublicId#""
class
=
""
approve-reject k-button"">Approve/Reject</
a
>#}#");
})
.Scrollable()
.Filterable(filterable => filterable.Extra(false).Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
)))
.Sortable(sortable => sortable.SortMode(GridSortMode.SingleColumn))
.Pageable(pageable => pageable.ButtonCount(5).PageSizes(new[] { 10, 25, 35 }).Info(true).Numeric(true).Messages(messages => messages.Display("Displaying {0} to {1} of {2} organizations")))
.DataSource(dataSource =>
dataSource
.Ajax()
.ServerOperation(true)
.Sort(sort => sort.Add("Status").Ascending())
.Read(read => read.Action("GetCompanies", "Organizations", new { Area = "MyCompanies" }).Type(HttpVerbs.Get))
))
<script type=
"text/javascript"
>
function
statusFilter(element) {
element.kendoDropDownList({
dataSource: [
{ text:
"A"
, value:
"1"
},
{ text:
"B"
, value:
"2"
},
{ text:
"C"
, value:
"3"
},
{ text:
"E"
, value:
"4"
}
],
filter:
"contains"
});
}
</script>
columns: [
...
{ title:
" "
, field:
"someBoolean"
, sortable:
true
,
template:
"#= DisplayCheckbox(IDx, IDy, someBoolean, this) #"
},
...
]
function
DisplayCheckbox(IDx, IDy, someBoolean, theCheckbox) {
return
'<input type="checkbox" onclick="AFunction('
+ IDx
+
', '
+ IDy
+
', '
+ theCheckbox +
')" '
+ (someBoolean
===
true
?
'checked '
:
''
) + (isAuthorized ===
true
?
''
:
'disabled'
) +
' />'
;
}
$(
"#personalDetails_files"
).kendoUpload({
async: {
saveUrl:
"/Uploader/SaveUserThumbnail.aspx"
,
removeUrl:
"/Uploader/RemoveUserThumbnail.aspx"
,
autoUpload:
true
,
multiple:
false
},
select:
function
(e) {
if
($(
'#personalDetails_files'
).parents(
".k-upload"
).find(
'.k-file'
).length >= 1) {
e.preventDefault();
}
},
upload:
function
(e) {
debugger;
},
success:
function
(e) {
if
(e.operation ==
"remove"
) {
//k-upload-button
$(
'#personalDetails_files'
).parents(
".k-upload"
).find(
'.k-upload-button'
).show();
$(
"#imgPersonalDetails_Thumbnail"
)[0].src =
"/styles/"
+ currentTheme +
"/default.png"
;
}
else
{
//k-upload-button
$(
'#personalDetails_files'
).parents(
".k-upload"
).find(
'.k-upload-button'
).hide();
$(
"#imgPersonalDetails_Thumbnail"
)[0].src =
"/UserThumbnails/"
+ window.currentUser.ID +
"_"
+ e.files[0].name;
}
//remove the select button
},
remove:
function
(e) {
},
error:
function
(e) {
}
});