How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Discuss anything related to web development but *no* technical support questions
Post Reply
User avatar
Paras
Posts: 6
Joined: Wed Jan 17, 2018 1:14 pm

How to set weekendFirstDay and weekendSecondDay with Extjs gantt ?

Post by Paras » Tue Aug 20, 2019 8:10 am

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

User avatar
mats
Core Developer
Core Developer
Posts: 14593
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

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

Post by mats » Tue Aug 20, 2019 10:57 am

Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
Paras
Posts: 6
Joined: Wed Jan 17, 2018 1:14 pm

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

Post by Paras » Tue Aug 20, 2019 3:51 pm

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:

Code: Select all

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 .

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2254
Joined: Fri Apr 01, 2016 11:08 am

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

Post by pmiklashevich » Tue Aug 27, 2019 8:50 pm

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:

Code: Select all

    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

Code: Select all

{
    "success"       : true,

    "calendars"     : {

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

Post Reply