Hello @polo1,
As I understand you want to add the custom control(like plus button on the demo), that will show a popup after click, in which you will be able to create an additional filter, am I right?
This requirement lays more on JavaScript, than in the Scheduler, as you have to create custom logic(the same way as in the following sample, or your own way, that will populate list of filters with the new one).
Here is an example of how it can be implemented with JS(click the “Add filter” button, so it will add an additional filter with values defined in inputs:
https://snippet.dhtmlx.com/y57l2hje
Here is the main logic of creating new filters:
let addFilterBtn = document.querySelector("#adf");
let labelInput = document.querySelector("#fil_label");
let filterTypeInput = document.querySelector("#fil_type");
let filtersListHTML = document.querySelector("#filters_wrapper");
addFilterBtn.addEventListener("click", () => {
const newFilterVal = filterTypeInput.value;
filters[newFilterVal.toLowerCase()] = true;
let htmlContent = `
<label class="checked_label" id="scale${filterTypeInput.value}">
<input type="checkbox" class="sch_radio" name="${labelInput.value.toLowerCase()}" value="1" checked/>
<i class="material-icons icon_color">check_box</i>${labelInput.value}
</label>
`;
filtersListHTML.children[filtersListHTML.children.length -1].insertAdjacentHTML( 'afterend', htmlContent);
initializeFilters();
scheduler.updateView();
})
The idea is to collet values for new filter from somewhere:
const newFilterVal = filterTypeInput.value;
Push the new filter value into the scheduler filters, like follows:
// default values for filters
var filters = {
appointment: true,
task: true,
training: true
};
....
filters[newFilterVal.toLowerCase()] = true;
After that you will have to create new checkbox control and push it into the HTML list with controls:
let htmlContent = `
<label class="checked_label" id="scale${filterTypeInput.value}">
<input type="checkbox" class="sch_radio" name="${labelInput.value.toLowerCase()}" value="1" checked/>
<i class="material-icons icon_color">check_box</i>${labelInput.value}
</label>
`;
filtersListHTML.children[filtersListHTML.children.length -1].insertAdjacentHTML( 'afterend', htmlContent);
Then reattach listeners for filters list(as there will be one new checbox control):
initializeFilters();
And then call the updateView
in order to repain the scheduler with new applied filter.
You can add any count of additional filters. If the requirement is have the exact behaviour that in the event calendar demo, you will have to update logic in demo, in order to show custom popup after click the Add filter
button, but logic will be similar.
Kind regards,