Hi I am trying to filter the scheduler based on a combo but can’t seem to figure it out.
I have filtering using a checkbox working, here is that code.
var course_Type_filters = {
1: true,
2: true,
3: true
};
var filter_inputs = document.getElementById(“filters_wrapper”).getElementsByTagName(“input”);
for (var i=0; i<filter_inputs.length; i++) {
var filter_input = filter_inputs[i];
// set initial input value based on filters settings
filter_input.checked = course_Type_filters[filter_input.name];
// attach event handler to update filters object and refresh view (so filters will be applied)
filter_input.onchange = function() {
course_Type_filters[this.name] = !!this.checked;
scheduler.updateView();
updIcon(this);
}
}
// here we are using single function for all filters but we can have different logic for each view
scheduler.filter_month = scheduler.filter_day = scheduler.filter_week = function(id, event) {
// display event only if its type is set to true in filters obj
// or it was not defined yet - for newly created event
if (course_Type_filters[event.course_type] || event.course_type==scheduler.undefined) {
return true;
}
// default, do not display event
return false;
};
var course_types = [
{ key: “1”, label: “Waterfront” },
{ key: “2”, label: “Schoolhouse” },
{ key: “3”, label: “Special Training” }
];
==============================================================
I do not know exactly how to do it using the combo box. Combobox ID = combo_instructor
scheduler.filter_month = scheduler.filter_day = scheduler.filter_week = function(id, event) {
if (combo_instructor.key = event.instructor) {
return true;
} else if (event.instructor==scheduler.undefined) {
return true;
} else if (combo_instructor.key = 0) {
return true;
}else {
// default, do not display event
return false;
}
};