This is a migrated thread and some comments may be shown as answers.

Difference between beforeHide and hide - an explanation

0 Answers 62 Views
Show your code
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stewart
Top achievements
Rank 1
Stewart asked on 12 Nov 2013, 06:04 PM
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
Tags
Show your code
Asked by
Stewart
Top achievements
Rank 1
Share this question
or