jQuery UI Widgets Forums Scheduler Anyone have experience customizing: Scheduler?

This topic contains 1 reply, has 2 voices, and was last updated by  admin 1 week, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • sande
    Participant

    What is the best way to show a loading spinner while jqxScheduler is retrieving events via AJAX?


    admin
    Keymaster

    Hi,

    jqxScheduler already has a built-in loading spinner when you bind it through the dataAdapter

    var source = {
        dataType: "json",
        dataFields: [
            { name: "id", type: "number" },
            { name: "subject", type: "string" },
            { name: "start", type: "date" },
            { name: "end", type: "date" }
        ],
        id: "id",
        url: "/api/events",
    
        loadServerData: function (serverdata, source, callback) {
            $("#scheduler").jqxScheduler('showloadelement');
    
            $.ajax({
                url: source.url,
                type: 'GET',
                data: serverdata,
                success: function (data) {
                    callback({ records: data });
                    $("#scheduler").jqxScheduler('hideloadelement');
                },
                error: function () {
                    $("#scheduler").jqxScheduler('hideloadelement');
                }
            });
        }
    };
    
    var dataAdapter = new $.jqx.dataAdapter(source);
    
    $("#scheduler").jqxScheduler({
        source: dataAdapter,
        date: new Date(),
        view: 'weekView'
    });

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.