Trying to deactivate click and context menu for some appointments

5 posts, 0 answers
  1. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 01 Jul 2014 Link to this post

    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);
                }
            }





  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 03 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 03 Jul 2014 in reply to Bozhidar Link to this post

    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.
  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 03 Jul 2014 Link to this post

    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.

     
  6. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 03 Jul 2014 in reply to Bozhidar Link to this post

    Ooops, I was editing my code so much back and forth that I did not realize I had posted that particular line.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017