Custom View Doesn't Destroy when Selecting Another View

3 posts, 1 answers
  1. Derek
    Derek avatar
    6 posts
    Member since:
    Nov 2015

    Posted 02 Dec 2015 Link to this post

    Hello,

     

    I created a project following the same methods as this project to build a scheduler with custom views. The issue I'm running into is that the code

     

    //detach events
            destroy: function () {
                if (this.element) {
                    this.element.off(NS);
                }
                ui.SchedulerView.fn.destroy.call(this);
            }

    never executes when I select another view. Instead, the view stays in place and the view I selected appears below it. If I toggle between my two custom views, they will simply stack. Is there any reason you now of why this might happen? Let me know if I need to upload a project, but it will take time to make it so it can be downloaded and run with minimal changes.

     

    Thanks for your help!

  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 04 Dec 2015 Link to this post

    Hello Derek,

    The view destroy method is called, when the widget itself is destroyed: If you listen to event that is triggered when the events are changed, then wire: or
    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Derek
    Derek avatar
    6 posts
    Member since:
    Nov 2015

    Posted 07 Dec 2015 Link to this post

    Hi Georgi,

     

    Thank you very much for your reply. I'm not sure why this was, but the solution to my conundrum was to add an option to my custom views. While I had already included the option:

     

     

    selectedDateFormat: "{0:D} - {1:D}"

    I added this option:

     

     

    selectedShortDateFormat: "{0:d} - {1:d}"

    And suddenly switching views worked perfectly.

Back to Top