dsternj / mobiscroll

Automatically exported from code.google.com/p/mobiscroll
0 stars 0 forks source link

How SetValue. #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I set the wheels values.
2.When the page init I need set value.

What is the expected output? What do you see instead?

I´d like use the method "setValue", but I don´t know how can I do it.
Is not a datetime, the control has custom values like the fruits sample.

Can you give me an example?

What version of the product are you using? On what operating system?
I am using version 1.5.2

Original issue reported on code.google.com by santy...@gmail.com on 2 Jan 2012 at 4:37

GoogleCodeExporter commented 9 years ago
$('#your_scroller').scroller('setValue', [1, 6, 7, 2 /* ... */]);

Where [1, 6, 7, 2] is an array with the values to be selected (not the labels).

Original comment by diosla...@gmail.com on 3 Jan 2012 at 7:11

GoogleCodeExporter commented 9 years ago
Thank for your help, but I couldn´t do it.

I set de wheels arrays so:

                var hoursList = [];
                var minutesList = [];

                for (var i = 0; i < 100; i++) {
                    if (i < 10) {
                        hoursList.push('0' + i.toString());
                        minutesList.push('0' + i.toString());
                    } else {
                        if (i < 60) {
                            minutesList.push(i.toString());
                        }
                        hoursList.push(i.toString());
                    }
                }

                var wheels = [{
                    'Horas': hoursList,
                    'Minutos': minutesList
                }];

And then, I did so:

$('#hourQuantity').scroller('setValue', [10, 20]);

But the value is still 00:00

What can I do?
Tahnks

Original comment by santy...@gmail.com on 3 Jan 2012 at 10:17

GoogleCodeExporter commented 9 years ago
You have to put the numbers in quotes, like so:

$('#hourQuantity').scroller('setValue', ["10", "20"]);

Original comment by a.w.ha...@gmail.com on 26 Apr 2012 at 7:59