I have a scheduler built with MVC and I would like for the events to be filtered by multiple fields. I am having difficulty in setting the filter logic along with the operators in the javascript.
Is there a way to filter by multiple values on a button click event?
Here are my selections:
<div id="tutors-listing"> Tutors <div id="tutors"> Adalhi<input type="checkbox" id="alex" aria-label="Alex" value="3"> Annik<input type="checkbox" id="bob" aria-label="Bob" value="4"> Bobby<input type="checkbox" id="charlie" aria-label="Charlie" value="5"> </div></div><div id="subjects-listing"> Subjects <div id="subjects"> AES<input type="checkbox" id="1" value="AES"> NURS<input type="checkbox" id="2" value="NURS"> ENG<input type="checkbox" id="3" value="ENG"> MED<input type="checkbox" id="4" value="MED"> </div> <button type="button" id="filter">Filter</button></div>
And here is my javascript. I am having issues getting the classesChecked value to show:
<script type="text/javascript"> $(function () { $("#filter").click(function () { var tutorsChecked = $.map($("#tutors :checked"), function (checkbox) { return parseInt($(checkbox).val()); }); alert(tutorsChecked); var filter = { logic: "or", filters: [ { logic: "and", filters: [ { field: "SUBJECT", operator: "eq", value: classesChecked } ] }, { logic: "and", filters: [ { field: "TutorID", operator: "gt", value: tutorsChecked } ] } ] }; var scheduler = $("#scheduler").data("kendoScheduler"); scheduler.dataSource.filter(filter); }); })</script>
Is there a better method to filter these values and how can I see the multiple value selections? Thanks in advance.
