This is a migrated thread and some comments may be shown as answers.

Scheduler resources datasource

8 Answers 305 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 06 Jan 2014, 02:32 AM
Hi, i'm a novice with kendo and grails, sorry if i make a dumb question

I want to use a remote datasource for the resources in the scheduler, and i have this:

        resources: [
            {
                field: "roomId",
                name: "Rooms",
                title: "Room",
                dataSource: {
                    type: "json",
                    transport:
                    {
                        read: {
                            url: "${createLink(controller:'panelControl', action:'getResources')}",
                            dataType: "json",
                            type: "GET"
                        }
                    }

And, in my controller i have this:

def getResources = {

   def map = [text:"Gromit", value:1, color:"#f58a8a"]

   return [myStringArray:map] as JSON

 }


When i run mi app, i have a 404 error: 
The requested resource (/ReservaYJuga/WEB-INF/grails-app/views/panelControl/getResources.jsp) is not available.

If i change my controller to render the view, doing something like that:

def getResources = {
def map = [text:"Gromit", value:1, color:"#f58a8a"]
render map as JSON
}

I get this: 
{"text":"Gromit","value":1,"color":"#f58a8a"}


Can somebody help me?

Thank you!




8 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 07 Jan 2014, 01:58 PM
Hi Tomas,

I checked the pointed Framework documentation and it seems that the correct way of returning Json to the client side is using the "render" keyword (the second example that you provide), however you should make sure that the response is wrapped as array in order to be understand by the scheduler resource dataSource. Please check the example response below:

[{"text":"Gromit","value":1,"color":"#f58a8a"}]

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
tomas
Top achievements
Rank 1
answered on 09 Jan 2014, 03:25 AM
Vladimir, thanks for the reply

Unfortunately, that doesnt work for me. In fact, it doesn't compile.

Any suggestions?
0
Vladimir Iliev
Telerik team
answered on 09 Jan 2014, 09:39 AM
Hi Tomas,

Apologise if I was not clear enough - the provided example was intended only to show you how the response from the server should look like on the client side and it's not intended to be applied directly to your server code. I would suggest to check the "Grails" documentation about how to achieve that behavior.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
tomas
Top achievements
Rank 1
answered on 14 Jan 2014, 03:58 AM
Vladimir,

Thank you for your replay and sorry for my delay.

Finally i can wrapp my response as an array, but when i render the list, i get this:

[{"text":"Gromit","value":1,"color":"#f58a8a"}]

Is the same that you said, but the scheduler doesnt work! Any ideas?

Thank you again for your help
0
Vladimir Iliev
Telerik team
answered on 14 Jan 2014, 06:54 AM
Hi Tomas,

Could you please make sure that the service is not returning "404 Error" (when you try to access it as you mention in the fist post) as well as if there is any JavaScript errors on the page that can prevents the scheduler from working?

Also please provide runable project where the issue is reproduced - this would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chittaranjan
Top achievements
Rank 1
answered on 19 Jun 2014, 06:46 PM
 public JsonResult GetAllEvents()
        {
            IList<Event> events = _eventService.GetAllEvents();
            return Json(events, JsonRequestBehavior.AllowGet);
        }
above call retuns
[{"EventId":1,"Title":"Chitta Birth Day","StartDate":"\/Date(1403145000000)\/","EndDate":"\/Date(1403148600000)\/","EventColor":"#CFCFCF"}]




0
Chittaranjan
Top achievements
Rank 1
answered on 19 Jun 2014, 06:49 PM
please help me on the above issue ,nothing being displayed in the scheduler.
Please suggest me if I am missing anything.
view file is attached and controller and return json is code is posted in the question.
there is no js error ,nothing but nothing is populated in scheduler.
0
Vladimir Iliev
Telerik team
answered on 23 Jun 2014, 08:26 AM
Hi Chittaranjan,

As this thread is out of the original topic, may I kindly ask you to open a new support thread for the Scheduler? In this way it is much easier to follow and concentrate on the particular issue which usually leads to its faster resolving.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
tomas
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
tomas
Top achievements
Rank 1
Chittaranjan
Top achievements
Rank 1
Share this question
or