JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://javascript.daypilot.org/sandbox/js/daypilot-all.min.js?v=1079"></script>
Hide all cars: <input type="checkbox" id="hidecars"/>
<div class="container">
<div id="dps"/>
</div>
<div id="log">
</div>
CSS
.container{
height:200px;
}
JavaScript
$(function(){
dps = new DayPilot.Scheduler("dps");
dps.viewType = "Gantt";
dps.timeHeaders = [
{groupBy: 'Month', format: 'MMMM yyyy'},
{groupBy: 'Week'},
{groupBy: 'Day'},
{groupBy: 'Hour', format:"HH:mm"}
];
dps.resources = [
{name:"Viktor", id:"Viktor"}
]
dps.onBeforeEventRender = function(args){
$("#log").html($("#log").html()+"<br/>"+args.e.type);
if(args.e.type == "car"){
if($("#hidecars").is(":checked")){
args.e.hidden = true;
}else{
args.e.hidden = false;
}
}
}
dps.events.list = [];
var guid = DayPilot.guid();
var guid2 = DayPilot.guid();
dps.events.list.push({
start:new DayPilot.Date().addHours(2),
end:(new DayPilot.Date()).addHours(5),
id: guid,
text: "Type boat",
type:"boat",
resource:"Viktor"
})
dps.events.list.push({
start:new DayPilot.Date().addHours(2),
end:(new DayPilot.Date()).addHours(5),
id: guid2,
text: "Type car",
type:"car",
resource:"Viktor"
})
$("#hidecars").click(function(){
dps.update();
})
dps.heightSpec = "Auto";//Parent100Pct
dps.cellWidthSpec = 'Auto';
dps.rowHeaderWidthAutoFit = false;
dps.businessBeginsHour = 10;
dps.businessEndsHour = 18;
dps.init();
})