mobiscroll number selects

48 views
Skip to first unread message

keldar

unread,
Aug 2, 2013, 11:05:55 AM8/2/13
to mobis...@googlegroups.com
Hi,

I have a mobiscroll instance which I use for numerical selects. The values available to me are:

[0, 1, 2, 3], [.], [0, 2, 5, 7] and [0, 5]

which looks as follows:

However, what I'd like (and what I'm not sure on how to do) is depending on what value is selected, is to disable another wheel depending on the value.

Thus, if a user selects x.2y or x.7y, then the 'y' wheel defaults to '5' and becomes disabled, if the user selects x.5y then the 'y' field defaults to '0' and disabled; if the user selects 3.xy, then the x AND y wheels default to '0' and become disabled.

How do I achieve this in mobiscroll, if someone could let me know then it would be appreciated :). My initialisation code is as follows:

                var bWheels = [{}];


                bWheels[0].one = {

                0: 0,

                1: 1,

                2: 2,

                3: 3

                };

                bWheels[0].sep = {

                '.': '.'

                };

                bWheels[0].two = {

                0: 0,

                2: 2,

                5: 5,

                7: 7

                }

                bWheels[0].three = {

                    0: 0,

                    5: 5

                };

                

                for (var i = 0; i < 4; i++) {

                    bWheels[0].one[i] = i;

                }

                

                $(".breakSelect").mobiscroll('destroy').mobiscroll({

                    wheels: bWheels,

                    showLabel: false,

                    formatResult: function(d) { // Fromat the array of values into a string

                        if (d[2] === "0" && d[3] === "0") {

                        return d[0];

                        }

                        

                        return d[0] + d[1] + d[2] + d[3]

                    },

                    width: 30,

                    theme: 'jqm'

                });

Reply all
Reply to author
Forward
0 new messages