or
$(document).ready(function () {
$('.AdvancedSearch input:checkbox').change(function () {
ApplyFilters();
});
ApplyFilters();
});
function updateFlagSearchFilters(field, operator, value) {
var grid = $("#Grid");
var newFilter = { field: field, operator: operator, value: value };
var dataSource = grid.data("kendoGrid").dataSource;
var filters = null;
if (dataSource.filter() != null) {
filters = dataSource.filter().filters;
}
if (filters == null) {
filters = [newFilter];
}
else {
var isNew = true;
var index = 0;
for (index = 0; index < filters.length; index++) {
if (filters[index].field == field) {
isNew = false;
break;
}
}
if (isNew && value != "" && value != "0" && value != "False") {
filters.push(newFilter);
}
else if (!isNew){
filters.splice(index, 1);
}
}
dataSource.filter(filters);
};
function ApplyFilters() {
var pt2Checked = $('#Pt2').is(':checked');
if (pt2Checked) {
updateFlagSearchFilters("Pt2", "eq", "true");
}
else {
updateFlagSearchFilters("Pt2", "neq", "");
}
};
<!DOCTYPE html>
<
html
><
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
/>
<
title
>Untitled Document</
title
>
<
link
href
=
"css/kendo.mobile.all.min.css"
rel
=
"stylesheet"
/>
<
script
src
=
"js/jquery.min.js"
></
script
>
<
script
src
=
"js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<
div
data-role
=
"view"
id
=
"foo"
>
<
a
href
=
"#protected"
data-role
=
"button"
>Go to protected</
a
>
</
div
>
<
div
data-role
=
"view"
id
=
"protected"
data-before-show
=
"redirectBack"
>
I am a protected view
</
div
>
<
script
>
var app = new kendo.mobile.Application();
function redirectBack(e) {
alert('s');
e.preventDefault();
app.navigate("#foo");
}
</
script
>
</
body
>
</
html
>