Page 1 of 1

How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Posted: Tue Aug 20, 2019 8:10 am
by Paras
I need to set weekendSecondDay and weekendFirstDay in my Extjs gantt panel. Where and how should i set the values? I was going through the docs but i could not understand how to use Gnt.data.Calendar.

Thanks,
Paras

Re: How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Posted: Tue Aug 20, 2019 10:57 am
by mats

Re: How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Posted: Tue Aug 20, 2019 3:51 pm
by Paras
Thank you for the quick reply.

I did read the guide but still i am confused as to how to use this for my purpose. I am using this:
var taskStore = 
Ext.create("Gnt.data.TaskStore", {
       calendar: new Gnt.data.Calendar({
                data:[
                    {
                        leaf                : true,
                        Name                : 'New Calendar',
                        DaysPerMonth        : 30,
                        DaysPerWeek         : 7,
                        HoursPerDay         : 24,
                        WeekendsAreWorkdays : true,
                        WeekendFirstDay     : 3,
                        WeekendSecondDay    : 0,
                        DefaultAvailability : [ '00:00-24:00' ]
                    }
                ]
            }),
});
Is this wrong ? Do i need to load calendar store or can i just pass values to make it work? I want wednesday to be WeekendFirstDay .

Re: How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Posted: Tue Aug 27, 2019 8:50 pm
by pmiklashevich
Hello,

You create an instance of Gnt.data.Calendar. There is no "data" in its config list. But there are weekendFirstDay, calendarId and so on, and all of them are named in camelCase. You can try it out in our Calendar demo running locally. Please modify examples/calendars/app/view/Gantt.js:
    initComponent : function() {
        var me = this,
            taskStore = new Gnt.data.TaskStore({
                // Schedule by constraints
                scheduleByConstraints            : true,
                // Activate logic to warn on:
                // - violating dependencies
                // - potential scheduling conflicts
                checkDependencyConstraint        : true,
                checkPotentialConflictConstraint : true,

                // calendarManager                  : new Gnt.data.CalendarManager({
                //     // we will use BusinessTime calendars
                //     calendarClass : 'Gnt.data.calendar.BusinessTime'
                // }),

                calendar : new Gnt.data.Calendar({
                    calendarId          : 'test',
                    name                : 'Test',
                    daysPerWeek         : 7,
                    daysPerMonth        : 30,
                    hoursPerDay         : 24,
                    weekendFirstDay     : 3,
                    weekendSecondDay    : 0,
                    weekendsAreWorkdays : false,
                    defaultAvailability : [
                        '00:00-24:00'
                    ]
                }),
and remove "projectCalendar" from examples/calendars/data/data.json to do not override specified calendar by another one loaded dynamically
{
    "success"       : true,

    "calendars"     : {

// NEED TO REMOVE THIS TO GET VALID JSON
//        "metaData"  : {
//            "projectCalendar"   : "general"
//        },
Best regards,
Pavel