Fullcalendar scheduler

335 views
Skip to first unread message

Andrea Fae'

unread,
Feb 5, 2017, 3:02:00 PM2/5/17
to web...@googlegroups.com
Someone can help me? Thank you

Any people can tell me how to load from database table resources to show using this add-on?


Any suggestion? Thanks a lot

Richard Vézina

unread,
Feb 6, 2017, 4:53:19 PM2/6/17
to web2py-users
For my part, I create a json generating controller then in a dummy (controller that does nothing else than returning a empty string variable to the view) web2py view I initialiaze the fullcalendar plugin with json feed (https://fullcalendar.io/docs/event_data/events_json_feed/)...

Good luck

Richard



On Sun, Feb 5, 2017 at 3:02 PM, Andrea Fae' <and...@gmail.com> wrote:
Any people can tell me how to load from database table resources to show using this add-on?


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 web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Vézina

unread,
Feb 6, 2017, 4:57:45 PM2/6/17
to web2py-users
Here a pointer to an old post of I regarding fullcalendar :


Richard

T.R.Rajkumar

unread,
Feb 7, 2017, 4:28:05 AM2/7/17
to web2py-users
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.

T.R.Rajkumar

unread,
Feb 7, 2017, 4:32:58 AM2/7/17
to web2py-users
You have to add this in view.
 <script src="{{=URL('static','js/moment.min.js')}}"></script>
 <script src="{{=URL('static','js/fullcalendar.js')}}"></script>


On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:

Richard Vézina

unread,
Feb 7, 2017, 9:43:23 AM2/7/17
to web2py-users
T.R. is the code you show us come from the AppointmentApplicance app?

If so, be notice that this way of integration with fullcalendar trigger a memory leaks... I am not sure it still the case of you have recent version of web2py or fullcalendar... But in the past I use to experiment this memory leak, that why I come up with the other way to integrate that I propose above (json feed).

Richard

--

Andrea Fae'

unread,
Feb 7, 2017, 2:16:50 PM2/7/17
to web2py-users
Thanks but I need RESOURCE because I want to use scheduler add-on...

T.R.Rajkumar

unread,
Feb 8, 2017, 5:08:22 AM2/8/17
to web2py-users
@Richard
          I do not know about memory leaks. How to detect a memory leak. Thanks for the notice.


On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:

Richard Vézina

unread,
Feb 8, 2017, 10:29:52 AM2/8/17
to web2py-users
Load the page containing the plugin integration repeatedly while looking at memory consumption with system monitor... It is normal that memory growth a bit, but at some point it should stop growing if it not you can suspect a memory leak. If I recall, using the Appliance app integration VM was crashing after sometimes playing with the plugin...

Richard

--

T.R.Rajkumar

unread,
Feb 10, 2017, 2:38:27 AM2/10/17
to web2py-users
Thank you Richard


Reply all
Reply to author
Forward
0 new messages