Giter Site home page Giter Site logo

Comments (4)

richardtallent avatar richardtallent commented on August 23, 2024 1

I've created a pull request #41 that allows for initializing the calendar with a local JSON object or XML string.

from monthly.

richardtallent avatar richardtallent commented on August 23, 2024

It appears there's been a pull request open since April that would allow loading from a local XML string. Not sure what the maintainer's plans are for improvements, but I'm in the same situation if I want to use this on an upcoming project.

The setMonthly() function needs to be split to separate the concerns of setting up the calendar for a given month, loading events from a resource, and adding events to the calendar view.

from monthly.

ka306575 avatar ka306575 commented on August 23, 2024

Please provide example for initializing the calendar with a local JSON object without making Ajax call

from monthly.

TonyDandelion avatar TonyDandelion commented on August 23, 2024

hi,you can change the function addEvents in monthly.js to use dynamic JSON data for date highlight. such as below.

    function addEvents(month, year) {
        if(options.events) {
            // Prefer local events if provided
            addEventsFromString(options.events, month, year);
        } else {
            var remoteUrl = options.dataType === "xml" ? options.xmlUrl : options.jsonUrl;
            if(remoteUrl) {
                // Replace variables for month and year to load from dynamic sources
                var url = String(remoteUrl).replace("{month}", month).replace("{year}", year);
                + var data = remoteUrl
                + addEventsFromString(data, month, year);
                - $.get(url, {now: $.now()}, function(data) {
                -   addEventsFromString(data, month, year);
                - }, options.dataType).fail(function() {
                -     console.error("Monthly.js failed to import " + remoteUrl + ". Please check for the correct path and " + options.dataType + " syntax.");
                - });
            }
        }
    }

from monthly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.