Bug _limit.js blocktime&unblocktime pass different days type

Hi All,

The calendar month view default blocktime on satyrday & sun. However, i need to unblocked specific saturday those are working day. How can i do that?

I had try the unblocktime, but no luck. Unfortunately still inactive - dimmed color & no pop up appear when i try to click on unblocktime sat.

If i mixed the days type, NOT WORKING
scheduler.blockTime(6, “fullday”);
scheduler.unblockTime(new Date(2013, 06, 20), “fullday”);
scheduler.setCurrentView();

If i used same type, then WORKING FINE
Method A:
scheduler.blockTime(new Date(2013, 06, 20), “fullday”);
scheduler.unblockTime(new Date(2013, 06, 20), “fullday”);
scheduler.setCurrentView();
Method B:
scheduler.blockTime([0,6], “fullday”);
scheduler.unblockTime(6"fullday");
scheduler.setCurrentView();

Please, is very urgent & desparate need help. :cry:

Thank you.

My source code:


scheduler.blockTime(6, "fullday");
scheduler.blockTime(0, "fullday");

 var holidays2 = [];
            var caps = [] ;
            $.ajax({
                    type: "POST",
                    async: false,
                    url: "<%=Url.Content("~/Calendar/GetHoliday/")%>",
                    data: { 'category': 'Working Day' },                                     
                    dataType: "json",
                    error: function (request) {
                        alert(request.responseText);
                        event.preventDefault();
                    },
                    success: function (data) {
                            for (var i = 0; i < data.length; i++) { 
                                holidays2[i] = new Date(data[i].s_date_y, data[i].s_date_m, data[i].s_date_d);
                            }
                    }                                                        
                });

                // Exception: Setting up sat & sun working day
                for (var i = 0; i < holidays2.length; i++) {
                    var date = holidays2[i];
                    //Unblock - saturday is a working day
                    scheduler.unblockTime (date, "fullday");       
                }

Regards,
Micheale

Hello Micheale,
currently it seems to be impossible to remove recurring timespans(that are defined by days of week) for a specific dates.
I think you’ll have to block saturdays and sundays by dates with the custom code. You can update blocking each time user changes date in the calendar, the code might look like following:

[code]scheduler.attachEvent(“onViewChange”, function (mode , date){
var state = scheduler.getState();
var from = state.min_date,
to = state.max_date;//min and max viewable dates
scheduler.deleteMarkedTimespan();//remove previously blocked times

while(from < to){//go through each displayed week

    //block saturday and sunday by date

//go to next week
    from = scheduler.date.add(from, 1, "week");
}
scheduler.updateView();

});[/code]

Thank you. It’s work now with your suggestion code.

One more question, when i try to block the sat & sun the deemed doesn’t cover all the block of the day. I need something like red highlight border section deemed as image below:

http://s17.postimg.org/8rvae4iwt/sat.jpg

I am trying to changing the dhtmlxscheduler.js and used watch:

scheduler._reset_month_scale = function (a, b, c) {
var d = scheduler.date.add(b, 1, “month”),
e = scheduler._currentDate();
this.date.date_part(e);
this.date.date_part©;
var f = Math.ceil(Math.round((d.valueOf() - c.valueOf()) / 864E5) / 7),
g = [],
h = Math.floor(a.clientHeight / f) - 22;
this._colsS.height = h + 22;
for (var k = this._colsS.heights = [], i = 0; i <= 7; i++) {
var j = (this._cols[i] || 0) - 1;
i === 0 && this.config.left_border && (j -= 1);
g[i] = " style=‘height:" + h + “px; width:” + j + "px;’ "
}
var m = 0;
this._min_date = c;
for (var n = “

”,
l = [], i = 0; i < f; i++) {
n += “”;
for (var p = 0; p < 7; p++) {
n += “<td”;
var q = “”;
//Loop from this._marked_timespans_ids & Compare the value with this.date;
// if exist; set q="dhx_after else run below {
c < b ? q = “dhx_before” : c >= d ? q = “dhx_after” : c.valueOf() == e.valueOf() && (q = “dhx_now”);
// } end

http://s16.postimg.org/to1nfafs3/watch_2.jpg

How can i performed that? Please advise.

Thank you.

Regards,
Micheale