issue with block time

hello all, I’m working on a Asp.net MVC application.
using the scheduler, I’m trying to block some times for some of my Y-axis variables.

The times should be unique to the individual.

It seems that when I add the “section” to the config of blocktime, It does not show-up on my timeline view. I’m sure my IDs are correct, but still no luck.

Code:

        scheduler.blockTime({
            days: [1, 2, 3, 4, 5],
            zones: [19 * 60, 24 * 60],
            sections: { timeline: [0, 1, 2, 3, 4, 5] }
        });

Hello,
make sure that view name in sections (‘timeline’) and the name of the timeline view are the same:scheduler.createTimelineView({ name: "timeline", ... }); scheduler.blockTime({ days: [1, 2, 3, 4, 5], zones: [19 * 60, 24 * 60], sections: { timeline: [0, 1, 2, 3, 4, 5] } });
And also make sure that timeline has sections with the same ids as specified in blockTime parameters.

The blockTime configuration is correct itself. I’ve tested it with the timeline sample from scheduler package (this one docs.dhtmlx.com/scheduler/sample … lines.html , had to enable limit extension), the last hours of the timeline gets blocked as expected

Thanks for the reply,

I have made the changes mentioned in your comments above, but the times on my scheduler are still not being blocked. I believe the problems lies in my section ids.

I’ll show you my scheduler configuration to give a better idea.

        scheduler.createTimelineView({
            name: "timeline",
            x_unit: "minute",
            x_step: 30,
            x_start: 16,
            x_date: "%H:%i",
            x_size: 24,
            x_length: 48,
            y_unit: engineers,
            event_day: 'full',
            y_property: "engineer_id",
            render: "bar"
        });

Engineers (from my controller):

            var engList = new List<object>();
      
            // viewModel is a list containing data taken from a database.
            foreach (var engineer in viewModel.engineers)
            {
                engList.Add(new { key = engineer.ID, label = engineer.Name });
            }

Finally my revised blockTime :

        scheduler.blockTime({
            days: [1, 2, 3, 4, 5],
            zones: [19 * 60, 24 * 60],
            sections: { timeline: [020602, 010201, 020525] }
        });

Even after adding the correct sections, The blockTime does not seem to be applying.

Oh!!
I figured out my mistake!

i had to change the name of “sections” to “engineers”

        scheduler.blockTime({
            days: [1, 2, 3, 4, 5],
            zones: [19 * 60, 24 * 60],
            engineers: { timeline: [020602, 010201, 020525] }
        });

Thanks for all your help!

Hi,
you may also have trouble with the key values. Numbers with leading zero might be interpreted as an octal numbers
developer.mozilla.org/en-US/doc … h_no_radix

For example, try this line in Google Chrome console (tried in v36)

var a = 020602; alert(a)

It shows the alert with ‘8578’, the same value you can get from parseInt(‘020602’, 8).
In order to ensure that keys won’t be interpreted as octal numbers, just wrap them in quotes, scheduler can work with string keys

var a = '020602'; alert(a)
timeline: ['020602', '010201', '020525']

Thanks for the tip, I’ll make the changes now.