ecommerce1986 / mobiscroll

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

instance of widget non-valuated in beforeShow call #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have overloaded the javascript Date object to allow non-standard date 
formatting, so your general parsing of the date isn't working correctly.   I am 
specifying the beforeShow function to specify the date that SHOULD be used with 
setDate.  However, inst is always undefined.  Adding the following to 
jquery.scroller-1.0b.js [around line 545] corrects the problem:

    if(!inst) inst = that;

What steps will reproduce the problem?
      $('.task_start_date','#task_create'+myId).scroller({
        preset: 'datetime',
        beforeShow: function(elm, inst) {
          if(inst) {
            var myDate = new Date($(elm).val());
            inst.setDate(myDate);
          }
        }
      });

What is the expected output? What do you see instead?
  when I specify beforeShow, inst should have a value, instead it is "unspecified"

What version of the product are you using? On what operating system?
-- jquery.scroller-1.0b.js
-- Firefox 3.6.8 Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by barh...@gmail.com on 9 Mar 2011 at 11:02

GoogleCodeExporter commented 8 years ago
Check that fix.  Instead of defining inst above, just pass "that" directly into 
the call.  IE: 

      that.settings.beforeShow(elm, that);

I found out that defining inst has a strange side effect later when you have 
multiple scrollers on the page.

Original comment by barh...@gmail.com on 10 Mar 2011 at 3:06

GoogleCodeExporter commented 8 years ago
Thanks for the report.
Fixed in rc2 by adding the following row to the show function:

s.beforeShow(elm, this);

This also fixes the other issue you submitted

Original comment by diosla...@gmail.com on 11 Mar 2011 at 7:51