Automatic init event on all Views

5 posts, 0 answers
  1. Fernando
    Fernando avatar
    66 posts
    Member since:
    Sep 2012

    Posted 20 Jun 2013 Link to this post

    Hi guys

    Is there a way to attach the same init method (beforeShow and show too) to all Views, without specifying on html? Or maybe a way to bind to an event that gets triggered from all Views?

    I think a good way to solve this would be the possibility to specify the View init method through the Layout. I have many Views with the same Layout, and all of them use the same init and show method. If we could put that in the Layout, the markup would become simpler and more maintainable.

    Thanks!
  2. Dean
    Dean avatar
    73 posts
    Member since:
    Oct 2012

    Posted 23 Jun 2013 Link to this post

    Hi Fernando,

    In my application I've used the 'viewShow' and 'navigate' events of the pane. These events are triggered for all views. You can read about it in the docs.

    For example:
    app.pane.bind("navigate",
        function() {
            console.log("app.pane.navigate");
        }
    );
    app.pane.bind("viewShow",
        function() {
            console.log("app.pane.viewShow " + app.pane.viewEngine.url);
        }
    );
  3. Fernando
    Fernando avatar
    66 posts
    Member since:
    Sep 2012

    Posted 24 Jun 2013 Link to this post

    Thanks, I'll try that!
  4. Fernando
    Fernando avatar
    66 posts
    Member since:
    Sep 2012

    Posted 24 Jun 2013 Link to this post

    A viewInit event on the Pane (or something like that) would be really useful. The navigate event does not give the reference to the new View being constructed.
  5. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 26 Jun 2013 Link to this post

    Hi Fernando,

    Thank you for the suggestion. We will consider exposing such event for our future releases.

    Regards,
    Petyo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top