We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Binding to OData seems to throw erroneous 500's & another question/request

I'm using Web API 2 w/ OData 3

Client side looks like this...

client-side code



When I run that, the Kanban UI just shows loading, but never completes. Browser console shows this...
browser error

But, if I right-click on the URL and select "open in new tab"... so I'm using the exact same url that the DataManager used, the browser doesn't get an error... it returns json as expected.
I've also stepped through the server-side code and it doesn't return a 500.
browser - no error

Additional questions/requests.

Notice in the first screenshot that I'm using MVC Razor to build up the columns array... it would be VERY nice if I could bind that in javascript to a property of the datamanager's result... ie. DataManager querys for a Project object. Project contains arrays for Columns and Cards... would be nice if the Kanaban control had properties to specify which property on the datasource contains the cards and which contains the columns. It seems to expect the datasource to only return an array of cards. Each Project could have different columns (statuses), so having to hard-code those is a huge limitation. The MVC server-side approach works, but I would prefer a client-side option.

It also seems that the Kanaban control is applying a lot of unnecessary query filters... checking for status in one of the columns, inlinecount and params
ensuring that cards are associated with a column belongs in the BL layer, not the UI. If somehow, a card gets orphaned (assigned to a Status w/ no corresponding Column), it should still get returned by the datasource. 
I'm not sure what purpose the inlinecount and params parts of the querystring serve... it returns the same results w/ those removed.

I see that in the screenshot, I have the wrong column names in the edit template, but that has since been removed... no impact, same error.

thanks,
john

2 Replies

JC John Crumpton August 5, 2016 09:55 PM UTC

Related to this... is it possible to just bind your controls to a javascript array w/o having to use the datamanager? Datamanager seems to be the source of a lot of my issues... the UI controls all work great. It may very well be the reason I have trouble w/ the datamanager is that I don't fully understand it and am misusing it... but I've been through the documentation repeatedly... it's a bit sparse. I also don't really see what I gain from using it as opposed to a simple ajax call using jquery/angular/ etc.

thanks again,
john


KN Kavitha Narayanan Syncfusion Team August 8, 2016 12:50 PM UTC

 
Thank you for contacting Syncfusion support. 
 
To Create sample with Datamanager using WebAPI and OData 
 
We did not face any issue in datamanager while using WebAPI with OData. We need to use below code in the WebApiConfig.cs file to resolve your mentioned issue. 
 
 
 
public static void Register(HttpConfiguration config) 
        { 
            HttpServer server = new HttpServer(config); 
            IEdmModel model; 
            using (NORTHWNDEntities context = new NORTHWNDEntities()) 
            { 
                model = GetModel();//Get model from dataSouce. 
            } 
 
            // Create our batch handler and associate it with the OData service. 
            ODataBatchHandler batchHandler = new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer); 
            config.MapODataServiceRoute("odata", "odata", model, batchHandler); 
           
            config.EnsureInitialized(); 
           
        } 
        public static Microsoft.OData.Edm.IEdmModel GetModel() 
        { 
            ODataModelBuilder builder = new ODataConventionModelBuilder(); 
 
            var order = builder.EntitySet<Employee>("Employee"); 
 
            FunctionConfiguration myFirstFunction = order.EntityType.Collection.Function("MyFirstFunction"); 
            
            myFirstFunction.ReturnsCollectionFromEntitySet<Employee>("Employee"); 
            
            return builder.GetEdmModel(); 
        } 
        } 
 
 
We have created a sample using WebAPI and OData without any issues. Please download from the following link. 
 
 
For more information, please refer to the link. 
 
 
We will create a KB for OData configuration and will update you once we completed. 
 
To Create sample without Datamanager 
 
Query: is it possible to just bind your controls to a javascript array w/o having to use the datamanager? 
 
We don’t face any issues with Data Manager using OData. For your request we prepared sample without using Data Manager. Can you please share us issues you are facing with Data Manager it will be helpful to analyze and resolve the issue. 
 
In another way, We are updating the Kanban datasource using “dataSource” method of Kanban through $.ajax method. 
 
Please refer to the code and sample. 
 
 
create: "CreateEvent",//create event 
. . . . . . . . .  
 
function CreateEvent(args) 
    {       
            var obj = $("#kanban").data("ejKanban") 
            $.ajax({ 
                url: 'Home/DataSource',//URL 
                type: 'GET', 
                data: { "id": obj._id }, 
                success: function (data1) { 
                    $("#kanban").ejKanban({ dataSource: data1 })//Assign the value to dataSource 
                } 
            }) 
    } 
 
public ActionResult DataSource(string id) 
        { 
            var DataSource = OrderRepository.GetAllRecords(); 
            return Json(DataSource, JsonRequestBehavior.AllowGet); 
        } 
 
 
Regards, 
Kavitha N. 


Loader.
Live Chat Icon For mobile
Up arrow icon