Hello
I have a scheduler that I want to filter on 2 different parameters (Team and Factory). With my current implementation I am only able to filter on one of the two. I have a dropdown for the teams and checkbuttons for the factories. So the aim is that you should be able to look at one or all teams AND 1 to all factories. How can I achive this filter?
This is what I got so far:
.Filter(filters =>
{
filters.Add(model => model.teamId).IsEqualTo(4).Or().IsEqualTo(5).Or().IsEqualTo(6);
filters.Add(model => model.factoryId).IsEqualTo(1).Or().IsEqualTo(2).Or().IsEqualTo(3);
})
Do I even really need this if I want to show everything default on load?
$(
"#teamDDL"
).change(
function
(e) {
var
checked = $.map($(
"#teamDDL"
),
function
(dropdown) {
return
parseInt($(dropdown).val());
});
if
(checked ==
"NaN"
)
checked = [4, 5, 6];
var
filter = {
logic:
"or"
,
filters: $.map(checked,
function
(value) {
return
{
operator:
"eq"
,
field:
"teamId"
,
value: value
};
})
};
var
scheduler = $(
"#scheduler"
).data(
"kendoScheduler"
);
scheduler.dataSource.filter(filter);
});
$(
"#factories :checkbox"
).change(
function
(e) {
var
checked = $.map($(
"#factories :checked"
),
function
(dropdown) {
return
parseInt($(dropdown).val());
});
var
filter = {
logic:
"or"
,
filters: $.map(checked,
function
(value) {
return
{
operator:
"eq"
,
field:
"factoryId"
,
value: value
};
})
};
var
scheduler = $(
"#scheduler"
).data(
"kendoScheduler"
);
scheduler.dataSource.filter(filter);
scheduler.view(scheduler.view().name);
});
So I have 2 functions for updating the filters, one for the dropdown and one for the checkboxes. I need to modify these two functions to do an AND search on both the dropdown value and the checkbox values, how do I do that?
BR
Jonas