Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't reset calendar with new data from database #92

Open
webeers opened this issue Oct 2, 2015 · 1 comment
Open

Can't reset calendar with new data from database #92

webeers opened this issue Oct 2, 2015 · 1 comment

Comments

@webeers
Copy link

webeers commented Oct 2, 2015

I am loading conferences with four dates (Registration Start and End dates and Conference Start and End dates). When I load the first conference, everything works fine. However, when I load another conference with difference dates, the calendars do not reflect the correct dates, but still hand on to the previous calendar configuration. I can't seem to initialize or destroy the datepicker. It won't render with the new dates.

Example: Conference 1 registration start date: 08/15/2015 - calendar shows August and highlights the 15th.
Then I select Conference 2 registration start date: 05/3/2015 - calendar still shows August 15th. I cannot reset the datepicker and I've tried about 40 or 50 difference configurations. If I can't get an answer I'm afraid I will have to switch controls.

@parrker
Copy link

parrker commented Oct 20, 2015

@webeers I've been doing something similar (loading new sets of data via ajax request), and came up with the following solution:

// When initialising the datepicker for the first time, save it 
// to a variable, so you can access it later
app.glDatePicker = $('#mydate').glDatePicker({
    // your params
}).glDatePicker(true);

Then when handling your ajax result:

$.get('some-url', {param: 'value'}, function(data) {
    // Modify required parameters
    app.glDatePicker.options.selectableDOW = data.availableDays;

    // Trigger the datepicker's render() method
    app.glDatePicker.render();
})

Worked for me, I hope it will for you as well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants