Kendo read url/ListView not working

5 posts, 0 answers
  1. Jayaram
    Jayaram avatar
    3 posts
    Member since:
    Mar 2016

    Posted 06 Apr Link to this post

    Hi,

    Below is my code in which URL is not routing to Controller page.Here domain is my local system URL.there is a div tag with id = detailId.trim() (detailID value is dynamically created while loading the web page).Can someone help me here.

     function detailInit(e) {
        
            var detailRow = e.detailRow;
            var detailId = detailRow.find(".catNumber").text();

       var dataSource1 = new kendo.data.DataSource({
                transport: {
                    read: {
         url: domain + "Ethno/GetMediaMetaData",
                        data: { id: '' + detailId.toString() },
                        dataType: "json"
                       
                    }
                },
               
                parameterMap: function (options) {
                    return kendo.stringify(options);
                }
            });
          
                $("#detailListView_" + detailId.trim()).kendoListView({
                    dataSource: dataSource1,
                template: kendo.template($("#detailMediaTemplate").html()),
                selectable: true,
                change: onChange
            });
            
        }

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 11 Apr Link to this post

    Hello Jayaram,

    I am not sure why exactly the controller is not being reached. I would recommend checking the browser's console and network tab for any messages that might give us a clue. Also, it's worth checking if the controller allows GET requests, which is what the DataSource will create by default.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Jayaram
    Jayaram avatar
    3 posts
    Member since:
    Mar 2016

    Posted 11 Apr in reply to Alexander Popov Link to this post

    Hi Alexander,

    Thankyou for your response.When I have checked the browser's console,I have found out error:

    Uncaught Error: Syntax error, unrecognized expression: #detailListView_E/1930/1/1     jquery.min.js:4.

    Here my input is: E/1930/1/1

    Could you kindly help me with this error.

     

    Regards,

    Jayaram

     

     

     

    Attaching the file for your reference

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 13 Apr Link to this post

    Hi,

    This happens because the slashes in the input cause the jQuery selector to generate an invalid expression. I would suggest either wrapping the ID selector in quotes or escaping the slashes using replace. Here is how the selector should look like after the changes: 
    //Desired result:
    $("[id='detailListView_E/1930/1/1']")
    $("#detailListView_E\\/1930\\/1\\/1")


    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Jayaram
    Jayaram avatar
    3 posts
    Member since:
    Mar 2016

    Posted 19 Apr in reply to Alexander Popov Link to this post

    I worked..thanks foe your help
Back to Top
Kendo UI is VS 2017 Ready