Scheduler resources datasource

9 posts, 0 answers
  1. tomas
    tomas avatar
    4 posts
    Member since:
    Jan 2014

    Posted 05 Jan 2014 Link to this post

    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!




  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 07 Jan 2014 Link to this post

    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!
  3. tomas
    tomas avatar
    4 posts
    Member since:
    Jan 2014

    Posted 08 Jan 2014 Link to this post

    Vladimir, thanks for the reply

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

    Any suggestions?
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 09 Jan 2014 Link to this post

    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!
  5. tomas
    tomas avatar
    4 posts
    Member since:
    Jan 2014

    Posted 13 Jan 2014 Link to this post

    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
  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 14 Jan 2014 Link to this post

    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!
  7. Chittaranjan
    Chittaranjan avatar
    2 posts
    Member since:
    Jun 2014

    Posted 19 Jun 2014 Link to this post

     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"}]




  8. Chittaranjan
    Chittaranjan avatar
    2 posts
    Member since:
    Jun 2014

    Posted 19 Jun 2014 in reply to Chittaranjan Link to this post

    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.
  9. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 23 Jun 2014 Link to this post

    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!
     
Back to Top