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

Select event tabstrip

4 Answers 331 Views
TabStrip (Mobile)
This is a migrated thread and some comments may be shown as answers.
Jolien
Top achievements
Rank 1
Jolien asked on 08 Jun 2012, 12:10 PM
Hi, 

I can't get the select event on the tabstrip working. It should log a console message that the select event was fired, but it does nothing. What am I doing wrong?

HTML markup:
<div data-role="layout" data-id="mobile-tabstrip">
    <div data-role="footer">
        <div data-role="tabstrip" id="tabStrip">
            <a href="#user" data-icon="contacts">User</a>
            <a href="#cycle" data-icon="play">Cycle</a>
            <a href="#stats" data-icon="toprated">Stats</a>
            <a href="#settings" data-icon="settings">Settings</a>
        </div>
    </div>
</div>

JS code:
var tabstripBound = false;
        var app = new kendo.mobile.Application($(document.body), {
            platform : "android",
            viewShow: function() {
                 if (!tabStripBound) {
                 var tabStrip = $("#tabStrip").data("kendoMobileTabstrip");
                 tabStrip.bind("select", onSelect);
                 tabStripBound = true;
                 }
              }
        });
         
        function onSelect(item){
            console.log("In on select");
        }

4 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 11 Jun 2012, 03:48 PM
Hello Jolien,

To achieve the needed functionality I would suggest to use the declarative event binding syntax and the data-select attribute for the TabStrip. For example: 
<div data-role="layout" data-id="mobile-tabstrip">
    <div data-role="footer">
        <div data-role="tabstrip" id="tabStrip" data-select="onSelect">
            <a href="#user" data-icon="contacts">User</a>
            <a href="#cycle" data-icon="play">Cycle</a>
            <a href="#stats" data-icon="toprated">Stats</a>
            <a href="#settings" data-icon="settings">Settings</a>
        </div>
    </div>
</div>
 
....
<script>
    function onSelect(){
        console.log("In on select");
    }
</script>

I hope this helps.


Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jolien
Top achievements
Rank 1
answered on 12 Jun 2012, 09:33 AM
Hi,

I can get this working for Android 2.x, but not for the 4.x version. 
0
Iliana Dyankova
Telerik team
answered on 12 Jun 2012, 01:15 PM
Hello Jolien,

I tested your scenario on Android 4.x version and everything works as expected. For convenience, I attached my test project - please check it and let me know if I missed something. Thank you in advance.


Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Shawn
Top achievements
Rank 2
answered on 18 Oct 2012, 07:03 PM
OK disregard my post as I found the issue -= my script was outside body so events could never call functions.

Tags
TabStrip (Mobile)
Asked by
Jolien
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Jolien
Top achievements
Rank 1
Shawn
Top achievements
Rank 2
Share this question
or