Search code examples
javascriptjqueryliferayscheduleralloy-ui

AlloyUI Scheduler Event Click


I'm using alloyui 2.0 scheduler http://alloyui.com/versions/2.0.x/ (with Liferay EE 6.2)

this is my scheduler :

  YUI().use('aui-scheduler', function(Y) {  
          var config = {
                    color: '#2bd434',
                    content: 'Prova!',
                    id: 'CUSTOM-ID',
                    disabled: true,
                    allDay: true
                }
                var Events = new Y.SchedulerEvent(config);
                var weekView = new Y.SchedulerWeekView();
                var scheduler =  new Y.Scheduler(
               {
                boundingBox: '#myScheduler',
                date: new Date(),
                items: [Events],
                render: true,
                views: [weekView]
               }
            )
    });

When I click on event, I want open another page with details of that specific event.

I have this listener on my scheduler :

 $("#myScheduler").on('click','.scheduler-event',function(e){
        console.log(e);
        var instance = this;
        console.log(e.currentTarget);
   });

I how can I set custom attributes on currentTarget? If is not possible, can I set a custom id for that event?(so I can get the detail of this one)


Solution

  • I solved doing this :

    Y.Do.after(function(e) {
            $('.popover').hide();
            var evt = e.getData('scheduler-event');
                var id = evt.get('id');
                //Other attr created in events array
                var MYATTRIBUTE = evt.get('MYATTRIBUTE');
        }, eventRecorder, 'showPopover');