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

Capturing events when "Editable" is false.

1 Answer 95 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 2
Alex asked on 22 Sep 2014, 07:12 AM
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.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 23 Sep 2014, 02:53 PM
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.

 
Tags
Scheduler
Asked by
Alex
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Share this question
or