Difference between beforeHide and hide - an explanation

1 posts, 0 answers
  1. Stewart
    Stewart avatar
    37 posts
    Member since:
    Oct 2013

    Posted 12 Nov 2013 Link to this post

    To save anyone else time (hopefully), here is the difference between beforeHide ("data-before-hide") and hide ("data-hide") - as documented at http://docs.kendoui.com/api/mobile/view#events-beforeHide

    Assuming you have two views and JS as follows:

    <div id="tabstrip-page1" data-role="view" data-title="Page 1" data-show="show1" data-before-hide="hide1">
        Page 1
    </div>
    <div id="tabstrip-page2" data-role="view" data-title="Page 2" data-show="show2" data-hide="hide2">
        Page 2
    </div>
      
    <script>
        function show1() {
            alert("Showing page 1");
        }
        function show2() {
            alert("Showing page 2");
        }
        function hide1() {
            alert("Hiding page 1");
        }
        function hide2() {
            alert("Hiding page 2");
        }
    </script>


    If you are on page 1 and click on your tabstrip to show page 2, the alerts will read (in this order):

    Hiding page 1
    Showing page 2

    Whereas, if you are on page 2 and click on your tabstrip to show page 1, the alerts will read (in this order):

    Showing page 1
    Hiding page 2

    So, the show event on page 1 fires before the hide event on page 2 - which is important to know if you are dependent on the order of show/hide!

    Hope this helps someone else!

    Stewart
Back to Top