How To Set OData-V4 xhrFields When Using Server Wrapper Fluent Syntax?

2 posts, 1 answers
  1. Russell
    Russell avatar
    8 posts
    Member since:
    Apr 2015

    Posted 17 Nov 2015 Link to this post

    How can one set xhrFields {withcredentials: true} when using an OData-V4 data source in an MVC Server Wrapper?

    I've gotten this far in the data source using the Fluent API:

     

    .DataSource(dataSource => dataSource
                        .Custom()
                        .Type("odata-v4")
                        .Transport(transport =>
                        {
                            transport.Read(read => read.Url("https://xxx/OData/Employee/FindEmployees"));
                        })
                        .ServerFiltering(true)
                    )

     

     But I need to be able to include credentials like am doing here:

    $("#EmpID").kendoComboBox({
                        placeholder: "Select employee",
                        dataTextField: "FullName",
                        dataValueField: "EmpID",
                        filter: "startswith",
                        autoBind: false,
                        minLength: 3,
                        dataSource: {
                            type: "odata-v4",
                            serverFiltering: true,
                            transport: {
                                read: {
                                    url: "https://xxx.com/OData/Employee/FindEmployees",
                                    xhrFields: {
                                        withCredentials: true}
                                }
                            }
                        }
                    });

     

     

     

  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 19 Nov 2015 Link to this post

    Hello Russell,

    You should use the overload of the Read method which accepts an object, similar to the following:

    transport.Read(new
    {
        url = "foo/bar",
        xhrFields =  new { withCredentials = true }
    });

    Regards,
    Rosen
    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
Back to Top