I need some help to assign values to first_hour and last_hour to the scheduler. I get them working with hardcoding the values directly but couldnt get the way to assign the values i get from ajax call to the scheduler config. Please help.
Here is my code:
[code]Index.cshtml:
@Html.Raw(ViewBag.scheduler.GenerateLinks())
scheduler.attachEvent("onTemplatesReady", function () {
scheduler.date.decade_start = function (date) {
var ndate = new Date(date.valueOf());
ndate.setDate(Math.floor(date.getDate() / 10) * 10 + 1);
return this.date_part(ndate);
}
$.ajax({
type: "POST",
url: window.location.pathname + "GS/GetTime",
success: function (result) {
//alert("settimingcheck");
if (result != null) {
var s1 = result.split('|');
startime = s1[0];
endtime = s1[1];
alert(startime + endtime);
// scheduler.config.first_hour = startime;
// scheduler.config.last_hour = endtime;
}
},
error: function (xhr, status, error) {
alert('Error settime');
}
});
//code working with hardcode values 8 and 20
scheduler.config.first_hour=8;
scheduler.config.last_hou=12;
scheduler.templates.decade_date = scheduler.templates.week_date;
scheduler.templates.decade_scale_date = scheduler.templates.week_scale_date;
scheduler.date.add_decade = function (date, inc) {
return scheduler.date.add(date, inc * 30, "day");
}
});
</script>
@Html.Raw(ViewBag.scheduler.GenerateHTML())[/code]