In controller
------------------
def home():
rows = db(db.cal_events).select()
return dict(rows=rows)
In view
------------
<script type="text/javascript">
$(document).ready(function() {
$('#calendar').fullCalendar({
aspectRatio: 0.7,
fixedWeekCount: false,
height: "auto",
contentHeight: "auto",
events: [
{{for i,row in enumerate(rows):}}{{if i!=0:}},{{pass}}
{
tip: '{{=row.title}}',
title: '{{=row.title}}',
allDay: false,
start: new Date('{{=row.start_date}}'),
end: new Date('{{=row.end_date}}')
}
{{pass}}
],
eventRender: function(event, element,view) {
if(event.start._d.getMonth() !==
$('#calendar').fullCalendar('getDate')._d.getMonth()) {
return false; // thanks jettpleyn
http://stackoverflow.com/questions/7628040/remove-past-dates-and-next-months-dates-from-the-current-month
}
element.attr('title', event.tip);
},
dayRender: function (moment, cell) {
/*var m = moment();*/
var day_of_the_week = moment.day();
if (day_of_the_week == 0)
cell.css("background-color", "yellow");
else
cell.css("background-color", "linen");
{{for i,row in enumerate(rows):}}
{{if row.lv_type == 'PH':}}
/*cell.css("background-color","yellow");*/
$('.fc-day[data-date="' + '{{=row.start_date}}' +
'"]').css('background-color', 'turquoise');
{{pass}}
{{if row.lv_type == 'AH':}}
$('.fc-day[data-date="' + '{{=row.start_date}}' +
'"]').css('background-color', '#FF8C8D');
{{pass}}
{{if row.lv_type == 'RH':}}
$('.fc-day[data-date="' + '{{=row.start_date}}' +
'"]').css('background-color', '#FF8C8E');
{{pass}}
{{if row.lv_type == 'SS':}}
$('.fc-day[data-date="' + '{{=row.start_date}}' +
'"]').css('background-color', 'silver');
{{pass}}
/*$('td[data-date="' + '{{=row.start_date}}' +
'"]').addClass('fully_colored_holiday');*/
$('.fc-other-month').html('');
$('.fc-other-month').css("background-color", "linen");
{{pass}}
}
})
});
</script>
Thats all.
On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:
>
> Someone can help me? Thank you
>
> Any people can tell me how to load from database table resources to show
> using this add-on?
>
> https://fullcalendar.io/scheduler/
>
> Any suggestion? Thanks a lot
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.