Hello Team,
In a month view, I have enabled max_month_events, and onViewMoreClick instead of going to the day view, I am looking for a way to get all the events by clicking onViewMoreClick action, and display all the events in the dropdown, so that users can quickly view all the events for the day.
Hello @rakeshkumar.jha ,
There is no built-in function for that, but you can redefine the _view_month_day
function(that currently opens the “day” view), to add the required functionality.
The code may look like follows:
function createList(items, parent){
var selectList = document.createElement("select");
selectList.classList.add("containered")
selectList.id = "mySelect";
parent.insertAdjacentElement('afterend', selectList);
for (var i = 0; i < items.length; i++) {
var option = document.createElement("option");
option.value = items[i];
option.text = items[i];
selectList.appendChild(option);
}
parent.remove();
}
scheduler.config.max_month_events = 1;
scheduler._view_month_day = function(e){
if(e.target.classList != "containered"){
var date = scheduler.getActionData(e).date;
var arr = scheduler.getEvents(date, scheduler.date.add(date, 1, "day"));
const names = arr.map(el => {
return el.text;
});
createList(names, e.target)
}
};
Here is a demo:
http://snippet.dhtmlx.com/5/87aabaa20
Thank for the workaround, will try the suggested solutions.