ajanthanm / mobiscroll

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

Destroy doesn't work #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create Scroller     
    $('.mobiscroll').scroller();    
2. Destroy Scroller
    $('.mobiscroll').scroller('destroy');
3. Click on Input field

What is the expected output? 
The Input field should get the focus and no scroller should appear.

What do you see instead?
The scroller will appear.

What version of the product are you using? On what operating system?
1.5

Please provide any additional information below.
My intention is to popup Mobiscroll with an icon and let the user use the input 
field like a normal input field. In the onClick Event of an image mobiscroll 
will be shown (works fine). In the onClose-Event of Mobiscroll I try to destroy 
the binding of the input-field to mobiscroll. But 'destroy' isn't working.

Do you have any ideas?

BTW: Nice work!

regards
Andreas

Original issue reported on code.google.com by andreas....@googlemail.com on 19 Sep 2011 at 1:49

GoogleCodeExporter commented 8 years ago
I'll check the destroy issue...

But for your scenario I would initialize mobiscroll with option 'showOnFocus' 
option set to false (Ooops, not in the doc...). And on your icon click call 
$('.mobiscroll').scroller('show');

Original comment by diosla...@gmail.com on 19 Sep 2011 at 2:49

GoogleCodeExporter commented 8 years ago
Thank you for your fast response!

There where two little issues left. For others interested in the 
'Image'-solution:

1. 'showOnFocus' only disables the onClick-Handler. The input-field is still 
readOnly.
TODO: Make input editable after initializing mobiscroll.

    mobiInput.scroller(defaults);
    mobiInput.removeAttr('readonly');
    mobiInput.attr('contentEditable',true);

2. The field is readOnly and 'show' doesn't get the new input. 
TODO: Set the new Date in the onClick-Handler of the image.

function showScroller() {
    var value = mobiInput.val();
    var date = $.scroller.parseDate('dd.mm.y',value,defaults); 
    mobiInput.scroller('setDate', date);
    mobiInput.scroller('show');
}

With these changes it works like a charm.

regards
Andreas

Original comment by andreas....@googlemail.com on 20 Sep 2011 at 8:13

GoogleCodeExporter commented 8 years ago
Thanks for the insights. We'll try to make this easier in a next release.

Original comment by diosla...@gmail.com on 20 Sep 2011 at 8:25

GoogleCodeExporter commented 8 years ago
Fixed in 1.5.1. Now it should work with only showOnFocus false, and call show 
on button click. Parse date, setDate, and modifying the readonly property is 
not necessary.

Original comment by diosla...@gmail.com on 21 Sep 2011 at 9:48