Capturing events when "Editable" is false.

2 posts, 0 answers
  1. Alex
    Alex avatar
    4 posts
    Member since:
    Sep 2014

    Posted 22 Sep 2014 Link to this post

    I am trying to use the Scheduler to display events only - I don't want to use any of the Schedulers built in editing functionality - instead I would just like to use javascript events such as "Change" or "Navigate".

    This works OK if I set the scheduler to Editable(true), however I don't want to be able to do things such as drag the events or delete them. If I set Editable to false it behaves as I would like except I can no longer capture any javascript events such as clicking on an item.

    I'd like to have Editable as false but capture which item was clicked on, or if a blank date is clicked on I'd like to capture the date that was clicked.

    The idea is that we would then load some event related information in another Partial View or something, it's for a user to browse, not to edit.

    How can I achieve this with the scheduler?

    Thanks.
  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 23 Sep 2014 Link to this post

    Hi Alex,

    Although, it will be possible to achieve the desired behavior by attaching click event handlers to the events and slot element, it will require adding additional code to get the already existing in the edit event information. Therefore, I suggest you to consider to keep using the edit event. However, you may disable moving, resizing, deleting events by switching off the appropriate Editable options: 

    @(Html.Kendo().Scheduler<ViewModel>()
        .Name("scheduler")
        .Editable(editable => editable.Destroy(false).Resize(false).Move(false))
        /*..*/
    )

    In order to prevent the edit form from appearing you can handle the edit event and call preventDefault:

    @(Html.Kendo().Scheduler<ViewModel>()
        .Name("scheduler")
        .Editable(editable => editable.Destroy(false).Resize(false).Move(false))
        .Events(events => events.Edit("edit"))
        /*..*/
    )
     
    <script type="text/javascript">
        function edit(e) {
            e.preventDefault();
            //TODO: do something with the event information
        }
    </script>



    Regards,
    Rosen
    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 MVC is VS 2017 Ready
Back to Top