Ability to alter the delete confirmation prompt

2 posts, 0 answers
  1. Erik
    Erik avatar
    42 posts
    Member since:
    Aug 2012

    Posted 15 Aug 2017 Link to this post

    When deleting an item a prompt message will appear:

    if a single occurrence: "Are you sure you want to delete this event?" <Delete> <Cancel>

    if recurrence: "Do you want to delete only this event occurrence or the whole series?" <Delete current occurrence> <Delete the series>

    I would like to add in the title of the event to the prompt text so the user can verify her/she is deleting the proper event.

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1228 posts

    Posted 17 Aug 2017 Link to this post

    Hello Erik,

    The required could be achieved by injecting the task title text into the prompt message using jQuery. To do that, in the dataBound event of the Scheduler you could attach a click event handler for the delete cross of the task. This click handler injects the additional text directly in the prompt element:
    dataBound: function(e) {
        $('.k-event-delete').on('click', function(e) {
        var targetEvent = e.target.closest('.k-event');
        setTimeout(function() {
          var eventText = $(targetEvent).find('.k-event-template:not(.k-event-time)').text();
          var messageElement = $('.k-popup-message');
          var currentText = messageElement.text();
          var newText = currentText.replace('this', '"' + eventText + '"');
            messageElement.text(newText);
        }, 0);
      });
    },

    Here you will find a simple Dojo, implementing the above.

    Regards,
    Veselin Tsvetanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top