Discuss anything related to web development but no technical support questions


Post by mfrancia »

hi

i did this
  timeCellRenderer: function (evts, m, rec, row, col, ds, start) {
                if (start.getDay() === 6  & rec.data.Id===1) {
                    m.css = 'weekend';
                }
            },
this work fine, but i need to set holidays in my schedule, these holidays come from a database table setting for specific country.
how can i do this, if the schedule have only store and eventstore.

thanks

Post by mats »

Well, use a third store holding the holiday dates then which you then access inside of your timeCellRenderer... Should be very simple actually :)

Post by mfrancia »

ok

i did this
var hol = new Ext.data.JsonStore(
        {
        api: {
            read: '../webservice/WSBaseScheduler.asmx/GetHolidays'
        },
        root: 'd.data',
        idProperty: 'HolidayId',
        sortInfo: { field: 'HolidayId', direction: "ASC" },
        // autoLoad:true,
        fields: [
             { name: 'HolidayId', type: 'int' },
                    { name: 'DayID', type: 'int' },
                    { name: 'CountryCode', type: 'string' },
                    { name: 'Date', type: 'Date' }
        ]
    });
but this is the timeCellRenderer( Array events, Object meta, Ext.data.Record record, Int row, Int col, Ext.data.Store ds, Date date, Date date, SchedulerPanel scheduler ) definition, so which parameter will be the new source?

thanks

thanks

Post by mats »

Now you can tie it into the function by using createDelegate:
timeCellRenderer: (function (evts, m, rec, row, col, ds, start) {
                if (start.getDay() === 6  & rec.data.Id===1) {
                    m.css = 'weekend';
                }
            }).createDelegate(null, [hol], true),
This will append hol as the last parameter to your function.

Post by mfrancia »

hi mats

i tried this
 timeCellRenderer: function (evts, m, rec, row, col, ds, start) {
                if (hol.data.items[0] != null) {
                    for (i=0;i<hol.data.length;i++)
                    {
                        if (start.format('d-M-y') === hol.data.items[i].data.HolidayDay.format('d-M-y')) {
                            m.css = 'weekend';
                        }
                    }
                }
            },
and i get to paint specific date,
Attachments
sch_custom.png
sch_custom.png (13.53 KiB) Viewed 7210 times

Post by mats »

Alright, so everything is ok then? :)

Post by mfrancia »

hi mats

i was setting different types of styles for my cells with this tecnique on the timeCellRenderer function, but now im population the schedule with more data and the styles doenst apply to the cells i want also sometimes doesnt appear the color i was setting in the specifi cells, could you please give me an example using delegates as you mention.

thanks

Post by mats »

Not sure what type of change you've made that caused this to stop working. What I suggest is for now:
timeCellRenderer: (function (evts, m, rec, row, col, ds, start) {
    var holidayStore = arguments[arguments.length-1];
 
                if (do-something-with-your-holiday-store) {
                    m.css = 'weekend';
                }
            }).createDelegate(null, [hol], true),

Post by adis »

Hi sorry to post on a 'old' post but for my research this is one of the must have functionality but I do not know how to implement.

So we need a resource scheduler, so persons (resources) have their own calendar.
Person A does not work on Friday.
Person B works only from 10 untill 2 o'clock.

How can I pass these 'special dates' when the scheduler panel gets rendered??
And how to restrict that events can be dropped on these special dates??

thanks for your reply.

Post by mats »

Isn't this exactly what's done in the "Drag drop from a grid example"? https://www.bryntum.com/examples/externa ... gdrop.html

Post Reply