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

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

1 Answer 186 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Russell
Top achievements
Rank 1
Russell asked on 18 Nov 2015, 03:24 AM

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}
                            }
                        }
                    }
                });

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 19 Nov 2015, 03:52 PM

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!
 
Tags
Data Source
Asked by
Russell
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or