DHTMLXscheduler - filter data getting resource not found

Hello,
I edited the Data unction to filter the data

[code] public ActionResult Data(int? officeid, int? locationid, long? providerid, int? typeid)
{//events for loading to scheduler

        return new SchedulerAjaxData( providerSchedulerRepository.getEvent(officeid, locationid,  providerid, typeid) );
    }[/code]

My javascript call is

function refreshScheduler(officeid, locationid, providerid, typeid) { officeid = $("#fk_Office").val(); locationid = $("#fk_Location").val(); providerid = $("#fk_Provider").val(); typeid = $("#fk_Type").val(); $.ajax({ url: "/ProviderScheduler/Data", async: false, type: "Post", data: { "officeid": officeid, "locationid": locationid, "providerid": providerid, "typeid": typeid }, success: function (data) { scheduler.clearAll(); scheduler.load(data); } }); };

On the surface everything seems to work fine, i call the Data and the server filter works great…
Except that I get an error in file dhtmlxsscheduler.js
at

scheduler.json.parse = function(data){ if (typeof data == "string"){ eval("scheduler._temp = "+data+";"); data = scheduler._temp.data||scheduler._temp; }

saying reosurce not found in data !

Help please.

thanks

scheduler.load is purposed to load data from remote url, if you need to load a data from the string you can use scheduler.parse

scheduler.parse(xml_data) //or scheduler.parse(json_data, "json");

Hi jaoude,

I am trying to implement schduler with following filters.

Country > City > Rooms.

Sample code is as below :
Javascript : function reload() {
roomID = $("#ddlRooms").val();
$.ajax({
url: “/Home/Rooms_SelectedRoom”,
/async: false,/
type: “Post”,
data: { roomID: $("#ddlRooms").val() },
success: function (data) {
scheduler.clearAll();
scheduler.load(data);
}
});
};

Controller.cs

//Controller action that returns a JSONRESULT – select a room as per dropdown selection.

    public JsonResult Rooms_SelectedRoom(RentalDataContext context, int? roomID)
    {
        JsonResult result = new JsonResult();
        var rooms = _SelectRooms(context, null,roomID);
        result.Data = rooms.ToList();
        result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
        return result;
    }

I am getting some un-handled error in scheduler.js file.
Can you please help me.

Thanks in advanced.

Please see Stanislav’s answer.
you need to use scheduler.parse(data, “json”); instead of scheduler.load

Hi Aliaksandr,

I am still getting error on Scheduler.js file as
‘start_date’ is null

My code is as below.

JSON Function :
public JsonResult Rooms_SelectedRoom(RentalDataContext context, int? roomID)
{
JsonResult result = new JsonResult();
var rooms = _SelectRooms(context, null,roomID);
result.Data = rooms.ToList();
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return result;
}

Javascript :
function reload() {

        roomID = $("#ddlRooms").val();
        $.ajax({
            url: "/Home/Rooms_SelectedRoom",
            type: "Post",
            data: { Room_ID: $("#ddlRooms").val() },
            success: function (data) {
                scheduler.clearAll();
                scheduler.parse(data, "json"); 
            }
                    });
    };

Dropdown :
@Html.DropDownList(“ddlRooms”, (IEnumerable)ViewData[“Room_ID”], new { id = “ddlRooms” , onchange=“reload();”})

scheduler.parse expects json string or array with calendar events, not rooms.
Are you trying to reload sections of Timeline or Units view?