Mobile back button error on click

4 posts, 0 answers
  1. Ety
    Ety avatar
    4 posts
    Member since:
    Jan 2012

    Posted 31 Jan 2013 Link to this post

    Hi,

    I am trying to use kendo.mobile.ui.BackButton inside a navbar, in a mobile web application (mvc.net).
    When taping the button I get the following error and then nothing happens:

    TypeError: Result of expression 'e' [undefined] in kendo.mobile.min.js:12

    here is my layout code (i'm using kendo version 2012.3.1114):

    <div data-role="layout" data-id="mobileLayout">
                <header data-role="header">
                    <div id="headerNavBarDiv" data-role="navbar">
                        <a id="backBtn" class="nav-button" data-align="left" data-role="backbutton">Back</a>
                        <div id="homeIconDiv" class="smallTempHomeIcon"></div>
                        <a id="showProjectHistory" data-align="right" data-role="button" data-icon="icon historyLight" style="display: none"></a>
                    </div>
                    <div id="titleDiv"></div>
                </header>
            </div>
            <script>
                var app;
                $(document).ready(function () {
                    app = new kendo.mobile.Application($(document.body), { layout: "mobileLayout" });
                });
            </script>


    As I understand from your documentation and lots of forum reading - this should be an easy one, but nothing I tried worked (including using the data-click or adding 'href=#:back')

    I'll more then appreciate your help in this matter.

    Thanks,
    Ety 



    kendo.mobile.min.js:12

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 04 Feb 2013 Link to this post

    Hi Ety,

    Your KendoUI code looks OK. I assume that the problem is caused by multiple initialization of the mobile application which is not supported (re-initialization of the Application will reset the history).

    Are you by any chance initializing the application in the _Layout page of the MVC project? If yes, please move the initialization code at the index page where the initial view is located. Also there is not need to use the document.ready event.

    Regards,
    Alexander Valchev
    the Telerik team
    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. Ety
    Ety avatar
    4 posts
    Member since:
    Jan 2012

    Posted 04 Feb 2013 Link to this post

    Hi Alexander,
    Thank you for your reply.

    You are correct - I do initialize the application in the _Layout page.
    I tried moving it to my first view like you suggested, but when I navigate to the next view - I don't see the layout at all...

    Any idea why?


    Thanks,
    Ety


  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 06 Feb 2013 Link to this post

    Hi Ety,

    Thank you for the feedback. I am glad to hear that the initial problem has been resolved.
    I am afraid that this time I cannot guess where exactly the problem comes from. Can you please verify that the application is initialized only once in the index page (it should not be initialized again in the other Views)?

    If this is not the case, please send me a small example that isolates the problem. In this way I would be able to examine your implementation in details and assist you further. Thank you in advance for the cooperation.

    Best regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready