Skip to main content
Participant
March 4, 2011
Question

How to use Spry and Jquery on the same page.

  • March 4, 2011
  • 1 reply
  • 507 views

I'm using both spry (dataset) and jquery (datepicker) on my page. When I load the jquery script my dataset doesn't work.

I've done some research and found that I need to insert an observer that tells jquery when the spry dataset is finished loading. Found this information at: http://forums.adobe.com/message/2899897. I've tried implementing this into my script but just doesn't seem to work. Below is the script from my site, how would I insert an observer into this script?

<script type="text/javascript">

<!--

var ds1 = new Spry.Data.HTMLDataSet("/test/fsasearch_results_dynamic.php", "search_results");

var ds2 = new Spry.Data.HTMLDataSet("/test/countstable_dynamic.php", "table");

$(function() { $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd', beforeShowDay: nonWorkingDates, numberOfMonths: 2, minDate: +5, maxDate: +30});

});

    function nonWorkingDates(date){

        var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;

        var closedDates = [[7, 29, 2009], [8, 25, 2010]];

        var closedDays = [[Saturday], [Sunday]];

        for (var i = 0; i < closedDays.length; i++) {

            if (day == closedDays[0]) {

                return [false];

            }

        }

        for (i = 0; i < closedDates.length; i++) {

            if (date.getMonth() == closedDates[0] - 1 &&

            date.getDate() == closedDates[1] &&

            date.getFullYear() == closedDates[2]) {

                return [false];

            }

        }

        return [true];

    }  

 

//-->

</script>

This topic has been closed for replies.

1 reply

Günter_Schenk
Inspiring
March 4, 2011

Please post any SPRY related question in the SPRY forum.