DayPilot HTML5 Scheduler - Show Only Empty rooms
6 years ago.
Hi.
I need to be able to filter bookings to only show "Empty Rooms". I have code in place to "hide empty" rooms (as provided by you - thank you)
dp.onRowFilter = function(args) {
var query = args.filter.query;
var hideEmpty = args.filter.hideEmpty;
if (args.row.name.toUpperCase().indexOf(query.toUpperCase()) === -1) {
args.visible = false;
}
else if (hideEmpty && args.row.events.isEmpty()){
args.visible = false;
}
};
... and then...
$(document).ready(function() {
function filter() {
dp.rows.filter({
query: $("#filter").val(),
hideEmpty: $("#hideEmpty").is(":checked")
});
}
$("#filter").keyup(function() {
filter();
});
$("#hideEmpty").change(function() {
filter();
});
$("#clear").click(function() {
$("#filter").val("");
dp.rows.filter(null);
return false;
});
});
... so we can currently see all bookings on screen (filtered by name, or room, or dates etc ) with empty rooms hidden, which is wonderful.
I would now like to be able to only show "empty rooms" via a checkbox to hide all booked rooms.
So I would select my dates on the nav calendar, then select (for example) "double rooms" then click a checkbox to hide all booked rooms (the opposite to hiding empty rooms) so it will only show all available rooms for these dates. I hope this makes sense.
Is this possible? Thank you once again in advance.
DayPilot