I'm currently using DayPilot Pro for ASP.NET MVC: 8.1.5819.1.
The objective is having 1 or 3 HeaderColumns depending on a parameter.
In my cshtml I declared the following :
"HeaderColumns = new RowHeaderColumnCollection { new RowHeaderColumn("Nom", 200), new RowHeaderColumn("Centre", 150), new RowHeaderColumn("Astreinte", 70) },"
In my js file I have this :
"dps.onCallBackStart = function (args) {
if (mode24 == "true") {
dps.rowHeaderColumns = [
{ title: 'Nom', width: 200 },
{ title: 'Centre', width: 150 },
{ title: 'Astreinte', width: 70 }
];
}
else {
dps.rowHeaderColumns = [
{ title: 'Nom', width: 200 }
];
}
}"
And finally, in my c# controller I made this :
"protected override void OnBeforeResHeaderRender(BeforeResHeaderRenderArgs e)
{
e.Columns.Clear();
if (planning.mode24)
{
var centre = DataSelectList.GetCentreDDL().Where( x => x.Value == e.DataItem.Source.ToString().Split(';')[1]).FirstOrDefault().Text;
var niveau_astreinte = e.DataItem.Source.ToString().Split(';')[2];
e.Columns.Add(new ResourceColumn(centre));
e.Columns.Add(new ResourceColumn(niveau_astreinte));
}
}"
When initializing the scheduler with 1 or 3 columns it works. When going from 3 columns to 1 it works, but when going from 1 column to 3, I can only see the first header column and the others are hidden under the scheduler.
Am I making any mistakes ? How can I achieve this ?