This is a migrated thread and some comments may be shown as answers.

Trying to deactivate click and context menu for some appointments

4 Answers 28 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
C
Top achievements
Rank 1
C asked on 01 Jul 2014, 12:59 PM
My Scheduler holds two different kinds of business objects, but I only want clicks for one of them. I'm thinking I should probably distinguish between them in the client-side click event. And one idea for doing that is by css class, as the ones I don't want to be clickable all have a common class. And so according to this http://www.telerik.com/help/aspnet-ajax/scheduler-schedulerappointment-object.html page there should be a get_cssClass() method. It does not produce the results I had hoped for though, and when I alert it's return value, it shows "[object Object]"

function AppointmentClick(sender, args) {
            var view = sender.get_selectedView();
            if (view != 4) {
                var appointment = args.get_appointment();                
                var appointmentID = appointment.get_id();
                var class = appointment.get_cssClass();
                alert(appointment);
                if (class != "resourceLightGrey")
                    addBooking(appointmentID);
            }
        }





4 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 03 Jul 2014, 06:47 AM
Hello,

It's not quite clear what you want to alert, however since the appointment client object is a javascript object, when you pass it directly into an alert statement, it will be printed out as "[object Object]". If you want to print out a specific property you have to alert it separately. For instance alert(appointment.get_cssClass()). You can also use the browser development tools and the console.log() function to print out the results, which will give you greater flexibility.

Regards,
Bozhidar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
C
Top achievements
Rank 1
answered on 03 Jul 2014, 06:53 AM
It's clear if you actually read my post. I wrote "And so according to this http://www.telerik.com/help/aspnet-ajax/scheduler-schedulerappointment-object.html page there should be a get_cssClass() method. It does not produce the results I had hoped for though, and when I alert it's return value, it shows "[object Object]""

Which is to say, I did not retrieve the cssClass, but rather it just said "object Object". And console.log did nothing. But I managed to get around this problem by manipulating the data server side instead.
0
Bozhidar
Telerik team
answered on 03 Jul 2014, 07:27 AM
Hi,

The following lines from the sample code where the appointment itself is alerted, rather than the cssClass caused my confusion:
var class = appointment.get_cssClass();
alert(appointment);

Glad you were able to find a solution for your issue.

Regards,
Bozhidar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
C
Top achievements
Rank 1
answered on 03 Jul 2014, 07:33 AM
Ooops, I was editing my code so much back and forth that I did not realize I had posted that particular line.
Tags
Scheduler
Asked by
C
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
C
Top achievements
Rank 1
Share this question
or