Hi,
I have been following the example http://demos.kendoui.com/web/grid/toolbar-template.html with a variation and I'm stuck.
I have a grid with multiple dropdownlist and textbox for filtering a kendo grid result. I'm having a problem implementing this but specifically when i try to compare the field value and the value in one of my control (eg dropdownlist value) . I'm trying to compare it to a field in a model list - see Award.AwardTypeID. this might be the cause why it's not working
i have a html input button for the javascript
Controller
Does anybody know how to properly do this?
Thanks,
Aaron
I have been following the example http://demos.kendoui.com/web/grid/toolbar-template.html with a variation and I'm stuck.
I have a grid with multiple dropdownlist and textbox for filtering a kendo grid result. I'm having a problem implementing this but specifically when i try to compare the field value and the value in one of my control (eg dropdownlist value) . I'm trying to compare it to a field in a model list - see Award.AwardTypeID. this might be the cause why it's not working
i have a html input button for the javascript
$(
'#btnSearch'
).on(
"click"
,
function
(e) {
refreshGrid();
return
false
;
});
function
refreshGrid() {
$filter =
new
Array();
$filter.push({ field:
"StudentID"
, operator:
"contains"
, value: $(
'#txtStudentID'
).val() });
if
($(
'#AwardType'
).val()) {
$filter.push({ field:
"Award.AwardTypeID"
, operator:
"eq"
, value: $(
'#AwardType'
).val() });
}
var
grid = $(
"#Grid"
).data(
"kendoGrid"
);
grid.dataSource.filter($filter);
grid.dataSource.read();
}
Controller
public ActionResult ApplicationSearch_Read([DataSourceRequest]DataSourceRequest request)
{
var
applications = context.Applications.Include(
"ApplicationDetails"
).OrderByDescending(p => p.SubmittedDate).ToList();
var
data = applications.Select(x =>
new
{
ApplicationID = x.ApplicationID,
SubmittedDate = x.SubmittedDate,
FirstName = x.FirstName,
LastName = x.LastName,
StudentID = x.StudentID,
IsApplicationSubmitted = x.IsApplicationSubmitted,
Award = x.ApplicationDetails.Select(y =>
new
{
AwardID = y.AwardDetail.AwardID,
AwardName = y.AwardDetail.Award.AwardName,
AwardTypeID = y.AwardDetail.Award.AwardTypeID
})
});
return
Json(data.ToDataSourceResult(request));
}
Does anybody know how to properly do this?
Thanks,
Aaron